generated from t/malachite
24 lines
597 B
JavaScript
24 lines
597 B
JavaScript
globalThis.LOGIN_ACCOUNT_TOKENS = JSON.parse(
|
|
window.localStorage.getItem("login_account_tokens") || "[]",
|
|
);
|
|
|
|
function save_login_account_tokens() {
|
|
window.localStorage.setItem(
|
|
"login_account_tokens",
|
|
JSON.stringify(LOGIN_ACCOUNT_TOKENS),
|
|
);
|
|
}
|
|
|
|
function user_logout() {
|
|
if (!confirm("Are you sure you would like to do this?")) {
|
|
return;
|
|
}
|
|
|
|
fetch("/api/v1/auth/logout", { method: "POST" })
|
|
.then((res) => res.json())
|
|
.then((res) => {
|
|
if (res.ok) {
|
|
window.location.href = "/";
|
|
}
|
|
});
|
|
}
|