diff --git a/www/assets/core.js b/www/assets/core.js index 99018ca..95790af 100644 --- a/www/assets/core.js +++ b/www/assets/core.js @@ -68,8 +68,10 @@ window.IP = (function () { return fetch(path, opt).then(function (res) { return res.json().catch(function () { return { code: res.status, msg: "响应解析失败" }; }) .then(function (data) { - if (res.status === 401 && path.indexOf("/login") === -1) { + if (res.status === 401 && path.indexOf("/login") === -1 && path !== "/api/admin/session") { // 多页之后没有「就地切回登录卡片」这回事,直接送回登录页 + // 例外:/api/admin/session 是登录页自己用来探「是否已登录」的, + // 401 = 未登录(正常态),不能在这里重定向,否则登录页会自刷新死循环 location.replace("login.html"); throw new Error(data.msg || "会话已过期,请重新登录"); }