diff options
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> + ); +} |