mirror of
https://github.com/JonasunderscoreJones/dash.jonasjones.dev.git
synced 2025-10-23 06:29:19 +02:00
added logout functionality
This commit is contained in:
parent
9a2d157d37
commit
e032477540
3 changed files with 20 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue