fix wrong base url when logout
This commit is contained in:
parent
c615612889
commit
e6a08c5229
|
|
@ -2,11 +2,14 @@
|
|||
* @Author: printempw
|
||||
* @Date: 2016-09-15 10:39:41
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-09-15 10:43:32
|
||||
* @Last Modified time: 2016-10-23 11:04:11
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// guesss base url
|
||||
var base_url = (location.pathname.endsWith('user') || location.pathname.endsWith('admin')) ? "." : "..";
|
||||
|
||||
function logout(with_out_confirm, callback) {
|
||||
if (!with_out_confirm) {
|
||||
swal({
|
||||
|
|
@ -21,7 +24,7 @@ function logout(with_out_confirm, callback) {
|
|||
type: 'success',
|
||||
html: json.msg
|
||||
});
|
||||
window.setTimeout('window.location = "../"', 1000);
|
||||
window.setTimeout('window.location = "'+base_url+'/"', 1000);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
|
@ -34,7 +37,7 @@ function logout(with_out_confirm, callback) {
|
|||
function do_logout(callback) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../auth/logout",
|
||||
url: base_url + "/auth/logout",
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
if (callback) callback(json);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user