Can sign out

This commit is contained in:
2021-05-12 18:57:30 +02:00
parent e75993b024
commit 1e6de3454f
2 changed files with 20 additions and 1 deletions

View File

@ -89,4 +89,18 @@ export class AccountHelper {
if (currentAccount == null) throw new Error("Current account is null!");
return currentAccount;
}
/**
* Sign out current user
*/
static async signOut() {
try {
await serverRequest("accounts/sign_out");
} catch (e) {
console.error(e);
}
sessionStorage.removeItem(SESSION_STORAGE_TOKEN);
document.location.href = document.location.href + "";
}
}