revamp template

This commit is contained in:
fro1991
2025-02-01 16:44:51 +07:00
parent c432df568a
commit 276a289580
1212 changed files with 112762 additions and 0 deletions

18
src/auth/RequireAuth.tsx Normal file
View File

@ -0,0 +1,18 @@
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { ScreenLoader } from '@/components/loaders';
import { useAuthContext } from './useAuthContext';
const RequireAuth = () => {
const { auth, loading } = useAuthContext();
const location = useLocation();
if (loading) {
return <ScreenLoader />;
}
return auth ? <Outlet /> : <Navigate to="/auth/login" state={{ from: location }} replace />;
};
export { RequireAuth };