more auth fixes (logout not removing localstorage objects)
This commit is contained in:
parent
069aeddaf9
commit
7dfea45e12
@ -20,10 +20,12 @@ export default function TimerHeader({
|
||||
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
||||
const [newTimerName, setNewTimerName] = useState<string>("");
|
||||
const [errors, setErrors] = useState<string[]>([]);
|
||||
const { friendName, setSignedIn } = useAuthContext();
|
||||
const { friendName, setSessionOver } = useAuthContext();
|
||||
|
||||
const logout = () => {
|
||||
fetch("/api/auth/logout").then(() => setSignedIn(false));
|
||||
fetch("/api/auth/logout").then(() => {
|
||||
setSessionOver(new Date());
|
||||
});
|
||||
};
|
||||
|
||||
const createTimer = (e: any) => {
|
||||
|
@ -79,10 +79,13 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
}
|
||||
return !!signedIn;
|
||||
});
|
||||
} else {
|
||||
setSignedIn(true);
|
||||
}
|
||||
|
||||
return sessionOver;
|
||||
});
|
||||
}, sessionOver.getTime() - Date.now());
|
||||
}, Math.max(0, sessionOver.getTime() - Date.now()));
|
||||
}, [sessionOver]);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user