tawny/app/public/tokens.js

25 lines
597 B
JavaScript
Raw Permalink Normal View History

2025-08-24 17:04:27 -04:00
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 = "/";
}
});
}