blessing-skin-server/resources/assets/src/scripts/logout.ts
Zephyr Lykos 9524a234cf
cleanup: wip 3.1
mostly misc cleanups
2024-02-24 23:01:32 +08:00

23 lines
443 B
TypeScript

import {post} from './net';
import {t} from './i18n';
import {showModal} from './notify';
import urls from './urls';
export async function logout() {
try {
await showModal({
text: t('general.confirmLogout'),
center: true,
});
} catch {
return;
}
await post(urls.auth.logout());
window.location.href = blessing.base_url;
}
const button = document.querySelector('#logout-button');
button?.addEventListener('click', logout);