style: 修改返回信息格式

This commit is contained in:
zhengxinonly
2024-01-31 22:52:41 +08:00
parent 801eed010f
commit c6598df116
10 changed files with 39 additions and 42 deletions
+11 -14
View File
@@ -120,20 +120,6 @@
var admin = layui.admin;
var popup = layui.popup;
// 请求后端,严重是否已经登录
fetch("/api/v1/user/profile", {
method: "GET",
headers: {
Authorization: "Bearer " + localStorage.getItem("access_token"),
},
})
.then((res) => res.json())
.then(function (data) {
if (data.code !== 0) {
location.href = "/view/login.html";
}
});
// 给 pear-admin-layui 的默认 ajax 请求添加权限
$.ajaxSetup({
headers: {
@@ -141,6 +127,17 @@
},
});
// 请求后端,严重是否已经登录
$.ajax({
type: "GET",
url: "/api/v1/user/profile",
success: function (data) {
if (data.code !== 0) {
location.href = "/view/login.html";
}
},
});
admin.setConfigurationPath("/static/config/pear.config.json");
admin.render();