summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-10-31 10:00:21 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-10-31 10:00:21 +0700
commitfe7fb860fc332247e53d8d193fd4c10c09503704 (patch)
tree3a0321d8ea07a3cf17c814e4cc66bd57363247ac /app
parent9c13df19a6ffe0dbfa291404cdfa72c8633b7200 (diff)
button logout
Diffstat (limited to 'app')
-rw-r--r--app/lib/camera/component/hedear.tsx18
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>
);