diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-31 10:00:21 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-31 10:00:21 +0700 |
| commit | fe7fb860fc332247e53d8d193fd4c10c09503704 (patch) | |
| tree | 3a0321d8ea07a3cf17c814e4cc66bd57363247ac /app/lib/camera/component/hedear.tsx | |
| parent | 9c13df19a6ffe0dbfa291404cdfa72c8633b7200 (diff) | |
button logout
Diffstat (limited to 'app/lib/camera/component/hedear.tsx')
| -rw-r--r-- | app/lib/camera/component/hedear.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/lib/camera/component/hedear.tsx b/app/lib/camera/component/hedear.tsx index 5cf3f1d..2a8bfc6 100644 --- a/app/lib/camera/component/hedear.tsx +++ b/app/lib/camera/component/hedear.tsx @@ -1,7 +1,17 @@ // components/Header.tsx import Image from "next/image"; +import { deleteAuth, getAuth } from "../../api/auth"; +import { Button } from "@mui/material"; +import { useRouter } from "next/navigation"; export default function Header() { + const auth = getAuth(); + const route = useRouter(); + + const handleSigOut = () => { + deleteAuth(); + route.push('/login'); + }; return ( <nav className="fixed top-0 left-0 w-full bg-white border-b-2 border-red-500 py-4 px-4 sm:px-96 z-50 shadow-md"> <div className="flex justify-between items-center"> @@ -14,7 +24,13 @@ export default function Header() { className="rounded-full" /> </div> - + {auth && ( + <div> + <Button size="small" onClick={() => handleSigOut()}> + Logout + </Button> + </div> + )} </div> </nav> ); |
