diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-09-18 13:23:23 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-09-18 13:23:23 +0700 |
| commit | 84d3b0070c5460f325a0189e4d50a6f74053bec1 (patch) | |
| tree | 822d985e9e22ac7b3fb5b9a2cb4840f9b273172a /app | |
| parent | 45bdacffcd37439bb17133b01f279330f159f517 (diff) | |
<Miqdad> Balikin
Diffstat (limited to 'app')
| -rw-r--r-- | app/lib/camera/component/hedear.tsx | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/app/lib/camera/component/hedear.tsx b/app/lib/camera/component/hedear.tsx index 81f5d01..2a8bfc6 100644 --- a/app/lib/camera/component/hedear.tsx +++ b/app/lib/camera/component/hedear.tsx @@ -1,53 +1,36 @@ // components/Header.tsx -"use client"; - import Image from "next/image"; import { deleteAuth, getAuth } from "../../api/auth"; import { Button } from "@mui/material"; import { useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; export default function Header() { - const router = useRouter(); - const [mounted, setMounted] = useState(false); - const [auth, setAuth] = useState<any>(null); - - useEffect(() => { - setMounted(true); - try { - setAuth(getAuth()); - } catch { - setAuth(null); - } - }, []); + const auth = getAuth(); + const route = useRouter(); - const handleSignOut = () => { + const handleSigOut = () => { deleteAuth(); - router.push("/login"); + 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"> <div className="flex items-center"> <Image - src="/images/indoteknik-logo.png" + src="/images/indoteknik-logo.png" // Ganti dengan path logo Anda alt="Logo" width={120} height={60} className="rounded-full" - priority /> </div> - <div> - {mounted && auth ? ( - <Button size="small" onClick={handleSignOut}> + {auth && ( + <div> + <Button size="small" onClick={() => handleSigOut()}> Logout </Button> - ) : ( - <span className="inline-block h-8 w-16" aria-hidden /> - )} - </div> + </div> + )} </div> </nav> ); |
