style: 修改返回信息格式
This commit is contained in:
+11
-14
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user