style: 修改 fetch 请求为 ajax,统一请求风格
This commit is contained in:
@@ -136,6 +136,9 @@
|
|||||||
location.href = "/view/login.html";
|
location.href = "/view/login.html";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
error: function (error) {
|
||||||
|
location.href = "/view/login.html";
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
admin.setConfigurationPath("/static/config/pear.config.json");
|
admin.setConfigurationPath("/static/config/pear.config.json");
|
||||||
@@ -143,16 +146,20 @@
|
|||||||
admin.render();
|
admin.render();
|
||||||
|
|
||||||
admin.logout(function () {
|
admin.logout(function () {
|
||||||
popup.success("注销成功", function () {
|
$.ajax({
|
||||||
fetch("/api/v1/logout")
|
type: "GET",
|
||||||
.then((res) => res.json())
|
url: "/api/v1/logout",
|
||||||
.then(function (data) {
|
success: function (data) {
|
||||||
if (data.code !== 0) {
|
console.log(data);
|
||||||
|
if (data.code === 0) {
|
||||||
localStorage.removeItem("access_token");
|
localStorage.removeItem("access_token");
|
||||||
localStorage.removeItem("refresh_token");
|
localStorage.removeItem("refresh_token");
|
||||||
|
popup.success("注销成功");
|
||||||
|
setTimeout(function () {
|
||||||
location.href = "/view/login.html";
|
location.href = "/view/login.html";
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 清空 tabs 缓存
|
// 清空 tabs 缓存
|
||||||
|
|||||||
Reference in New Issue
Block a user