blessing-skin-server/resources/assets/src/scripts/logout.ts
2020-01-16 16:14:49 +08:00

21 lines
433 B
TypeScript

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