mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-13 18:09:20 +00:00
feat: implement user profile page and integrate profile fetching logic in AccountPopover and ApplicationLayout components ✨
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
"use client";
|
||||
import { Loader2, User as UserIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import { Loader2, User as UserIcon } from "lucide-react";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AccountPopover() {
|
||||
const session = useSession();
|
||||
@ -36,16 +37,24 @@ export function AccountPopover() {
|
||||
<p>{session.data?.user?.mobile}</p>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
disabled={loading}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await signOut();
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{loading ? <Loader2 className="animate-spin" /> : "Logout"}
|
||||
</Button>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Button
|
||||
disabled={loading}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await signOut();
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{loading ? <Loader2 className="animate-spin" /> : "Logout"}
|
||||
</Button>
|
||||
<Link href="/profile" className="text-muted-foreground">
|
||||
<Button variant={"secondary"} className="w-full">
|
||||
View Profile
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { NuqsAdapter } from 'nuqs/adapters/next/app'
|
||||
import { getProfile } from "@/actions/payment";
|
||||
import { getProfile } from "@/actions/user-actions";
|
||||
import { authOptions } from "@/app/auth";
|
||||
import { DeviceCartDrawer } from "@/components/device-cart";
|
||||
import { ModeToggle } from "@/components/theme-toggle";
|
||||
|
Reference in New Issue
Block a user