blessing-skin-server/resources/assets/src/js/general.js
2016-12-17 19:02:56 +08:00

51 lines
1.2 KiB
JavaScript

/*
* @Author: printempw
* @Date: 2016-09-15 10:39:41
* @Last Modified by: printempw
* @Last Modified time: 2016-12-17 18:47:02
*/
'use strict';
function logout(with_out_confirm, callback) {
if (!with_out_confirm) {
swal({
text: trans('general.confirmLogout'),
type: 'warning',
showCancelButton: true,
confirmButtonText: trans('general.confirm'),
cancelButtonText: trans('general.cancel')
}).then(function() {
do_logout(function(json) {
swal({
type: 'success',
html: json.msg
});
window.setTimeout(function() {
window.location = blessing.baseUrl;
}, 1000);
});
});
} else {
do_logout(function(json) {
if (callback) callback(json);
});
}
}
function do_logout(callback) {
$.ajax({
type: "POST",
url: blessing.baseUrl + "/auth/logout",
dataType: "json",
success: function(json) {
if (callback) callback(json);
},
error: showAjaxError
});
}
$(document).ready(function() {
$('li.active > ul').show();
});