Skip to content
Snippets Groups Projects
Commit 532fffca authored by Cross, Liam (UG - Comp Sci & Elec Eng)'s avatar Cross, Liam (UG - Comp Sci & Elec Eng)
Browse files

Refresh now properly considers auth on protected routes

parent 898bc6f4
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ export interface IUser {
}
function AuthProvider({ children }: { children: ReactNode }) {
const [auth, setAuth] = useState(false);
const [auth, setAuth] = useState(true);
const [user, setUser] = useState<IUser>();
const data = useLoaderData() as IUser | null;
......@@ -18,6 +18,9 @@ function AuthProvider({ children }: { children: ReactNode }) {
if (data) {
giveAuth();
setUser(data);
} else {
removeAuth();
setUser(undefined);
}
}, []);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment