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