diff --git a/src/pages/staff.tsx b/src/pages/staff.tsx index 1d91828..cb98312 100644 --- a/src/pages/staff.tsx +++ b/src/pages/staff.tsx @@ -8,6 +8,7 @@ import Link from 'next/link'; import NotAllowed from '@/components/NotAllowed'; import { useToast } from '@/components/Toast'; import { httpPost } from '@/utils/axios'; +import Button from '@/components/WalkRally/Home/components/Button'; function Scan() { const { isAuthenticated, isReady, user } = useAuth(); @@ -16,6 +17,28 @@ function Scan() { const router = useRouter(); const toast = useToast(); + const [canAccess, setCanAccess] = useState(false); + const [password, setPassword] = useState(''); + + const handleSavePassword = () => { + if (password === 'lmao123456-thee') { + localStorage.setItem('access', 'true'); + setCanAccess(true); + toast?.setToast('success', 'Logged in successfully'); + } else { + toast?.setToast('error', 'Wrong password'); + } + }; + + useEffect(() => { + const access = localStorage.getItem('access'); + if (access === 'true') { + setCanAccess(true); + } else { + setCanAccess(false); + } + }, []); + const handleScanResult = (token: any, error: any) => { if (token) { setData(token.text); @@ -50,6 +73,30 @@ function Scan() { if (!isAuthenticated || !isReady || user?.studentID.startsWith('66')) return ; + if (!canAccess) { + return ( +
+
+

Login for Staff

+
+ setPassword(e.target.value)} + placeholder="Password" + className="w-full rounded-lg border border-black px-4 py-2 outline-none" + /> + +
+
+
+ ); + } + return (