From 7f92392a1feeb94cefa2bc65dfc9747bade17821 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 11 Nov 2025 21:51:30 +0000 Subject: [PATCH] completionId: cgen-09daffde5f524ffd87bc71303ec04f5a cgen-09daffde5f524ffd87bc71303ec04f5a --- client/pages/Staff.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/pages/Staff.tsx b/client/pages/Staff.tsx index 781d5666..2704c61a 100644 --- a/client/pages/Staff.tsx +++ b/client/pages/Staff.tsx @@ -18,14 +18,24 @@ import { } from "lucide-react"; import { useNavigate } from "react-router-dom"; import { useEffect, useState, useRef } from "react"; +import { useAuth } from "@/contexts/AuthContext"; import LoadingScreen from "@/components/LoadingScreen"; import { aethexToast } from "@/lib/aethex-toast"; export default function Staff() { const navigate = useNavigate(); + const { user, loading } = useAuth(); const [isLoading, setIsLoading] = useState(true); const toastShownRef = useRef(false); + // Redirect unauthenticated users to login + useEffect(() => { + if (!loading && !user) { + navigate("/staff/login", { replace: true }); + return; + } + }, [user, loading, navigate]); + useEffect(() => { const timer = setTimeout(() => { setIsLoading(false);