From bf8b6aacbbfef3df4b56be5e63e8f983d71f9c7c Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 20 Sep 2025 10:32:53 +0700 Subject: fix compile error --- app/lib/camera/component/hedear.tsx | 54 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'app/lib/camera') diff --git a/app/lib/camera/component/hedear.tsx b/app/lib/camera/component/hedear.tsx index 81f5d01..37935bd 100644 --- a/app/lib/camera/component/hedear.tsx +++ b/app/lib/camera/component/hedear.tsx @@ -1,4 +1,3 @@ -// components/Header.tsx "use client"; import Image from "next/image"; @@ -7,48 +6,47 @@ import { Button } from "@mui/material"; import { useRouter } from "next/navigation"; import { useEffect, useState } from "react"; +interface AuthPayload { + token?: string; + email?: string; + name?: string; + [k: string]: unknown; +} + export default function Header() { const router = useRouter(); const [mounted, setMounted] = useState(false); - const [auth, setAuth] = useState(null); + const [auth, setAuth] = useState(null); useEffect(() => { setMounted(true); - try { - setAuth(getAuth()); - } catch { - setAuth(null); - } + const a = getAuth() as AuthPayload | string | null; + setAuth(a); }, []); - const handleSignOut = () => { + const onLogout = () => { deleteAuth(); router.push("/login"); }; + if (!mounted) return null; + return ( - + ); } -- cgit v1.2.3