mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
Add missing logout
This commit is contained in:
parent
0889276494
commit
4470b7ba9c
@ -1,3 +1,4 @@
|
||||
import './i18n';
|
||||
import './net';
|
||||
import './layout';
|
||||
import './logout';
|
||||
|
25
resources/assets/src/js/logout.js
Normal file
25
resources/assets/src/js/logout.js
Normal file
@ -0,0 +1,25 @@
|
||||
import { post } from './net';
|
||||
import { swal } from './notify';
|
||||
import { trans } from './i18n';
|
||||
|
||||
export async function logout() {
|
||||
const { dismiss } = await swal({
|
||||
text: trans('general.confirmLogout'),
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: trans('general.confirm'),
|
||||
cancelButtonText: trans('general.cancel')
|
||||
});
|
||||
if (dismiss) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { msg } = await post('/auth/logout');
|
||||
setTimeout(() => window.location = blessing.base_url, 1000);
|
||||
swal({
|
||||
type: 'success',
|
||||
html: msg
|
||||
});
|
||||
}
|
||||
|
||||
$('#logout-button').click(logout);
|
Loading…
Reference in New Issue
Block a user