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