diff options
author | polwex <polwex@sortug.com> | 2025-05-15 12:17:54 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-05-15 12:17:54 +0700 |
commit | 1ae274a658d0a705b698a8873c286ec73403b1a6 (patch) | |
tree | 12d4d77404a3b3862fbc949a581fe598a0d8c152 /src/components/Profile.tsx | |
parent | ee2352b5268a1f33c4db72237a7c5171f0c1efbc (diff) |
m
Diffstat (limited to 'src/components/Profile.tsx')
-rw-r--r-- | src/components/Profile.tsx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx new file mode 100644 index 0000000..2ae73e9 --- /dev/null +++ b/src/components/Profile.tsx @@ -0,0 +1,36 @@ +"use client"; + +import { postLogout } from "@/actions/login"; +import { Button } from "@/components/ui/button"; +import { + Card, + CardHeader, + CardDescription, + CardContent, + CardFooter, + CardTitle, +} from "@/components/ui/card"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { useActionState } from "react"; + +export default function ({ user }: { user: { name: string; id: number } }) { + const [state, formAction, isPending] = useActionState(postLogout, 0); + return ( + <form action={formAction}> + <Card> + <CardHeader> + <CardTitle>Profile</CardTitle> + {state} + </CardHeader> + <CardContent> + <p>Username: {user.name}</p> + <p>User ID: {user.id}</p> + </CardContent> + <CardFooter> + <Button type="submit">Log out</Button> + </CardFooter> + </Card> + </form> + ); +} |