diff --git a/js/common.js b/js/common.js index 6f22098..bc8d031 100644 --- a/js/common.js +++ b/js/common.js @@ -19,22 +19,22 @@ function $ajax(url) { }) .then(function (res) { var data = typeof res.data == "string" ? JSON.parse(res.data) : res.data - if (data.code == 401) reject() + if (data.code == 401) { + showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, { cover: true }) + reject() + } if (data.code == 201) creationAlertBox("error", res.message || res.msg) resolve(data) }) .catch(err => { - if (err.response.status == 401) - showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, { - cover: true, - }) + if (err.response.status == 401) showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, { cover: true }) }) }) } function $ajaxget(url, data) { - if (!data) data = {} - + if (!data) data = {} + data["authorization"] = "813blr43ue2hhf2kjnlfibyy9swlxm2x" url = url.indexOf("https://") > -1 ? url : projectBaseURL + url @@ -51,11 +51,15 @@ function $ajaxget(url, data) { ) .then(function (res) { var data = typeof res.data == "string" ? JSON.parse(res.data) : res.data - if (data.code == 401) reject() + if (data.code == 401) { + showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, { cover: true }) + reject() + } if (data.code == 201) creationAlertBox("error", res.message) resolve(data) }) .catch(error => { + if (error.response.status == 401) showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, { cover: true }) reject(error) }) })