diff --git a/src/lib/session.js b/src/lib/session.js index 282cff2..f45be20 100644 --- a/src/lib/session.js +++ b/src/lib/session.js @@ -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(); diff --git a/src/routes/Header.svelte b/src/routes/Header.svelte index fd49cc8..ba8a233 100644 --- a/src/routes/Header.svelte +++ b/src/routes/Header.svelte @@ -29,6 +29,9 @@
  • About
  • +
  • + Logout +
  • {/if}
    +

    Logging out...

    +

    Redirecting to the login page...

    +
    \ No newline at end of file