1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

#70 AUTH 错误处理

This commit is contained in:
mukaiu 2018-09-25 15:35:56 +08:00
parent 4e6cd93cbd
commit 89f0fc2105
2 changed files with 27 additions and 0 deletions

View File

@ -99,6 +99,19 @@
$.ajax(payload)
.done(function (data) {
console.log('Rest api 返回的值:', data);
if (data.status && data.status === "AUTH_ERROR") {
layer.confirm('会话过期,请重新登录!', {
btn: ['是', '否'],
icon: 2,
title: '提示'
}, function (index, layero) {
layer.close(index)
top.location.href = '/logout.html'
}, function (index) {
// 取消方法
});
return;
}
if (data.rc == 0) {
cb(null, data.data);
} else {

View File

@ -51,6 +51,20 @@
$.ajax(payload)
.done(function (data) {
console.log('Rest api 返回的值:', data);
if (data.status && data.status === "AUTH_ERROR") {
layer.confirm('会话过期,请重新登录!', {
btn: ['是', '否'],
icon: 2,
title: '提示'
}, function (index, layero) {
layer.close(index)
top.location.href = '/logout.html'
}, function (index) {
// 取消方法
});
return;
}
if (data.rc == 0) {
resolve(data.data);
} else {