added logout functionality

This commit is contained in:
Jonas_Jones 2025-03-07 19:14:05 +01:00
parent 9a2d157d37
commit e032477540
3 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,11 @@ export function redirectToLogin() {
window.location.href = `/login?returnUrl=${currentPath}`;
}
export function resetSession() {
document.cookie = `sessionKey=; path=/; max-age=0`;
window.location.href = '/login';
}
export function ensureAuthenticated() {
if (!getSessionKey()) {
redirectToLogin();