|
@@ -12,7 +12,7 @@ const codeMessage = {
|
|
|
202: '一个请求已经进入后台排队(异步任务)。',
|
|
|
204: '删除数据成功。',
|
|
|
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
|
- 401: '没有权限,请刷新页面并重新登录',
|
|
|
+ 401: '没有权限,您可能需要重新登录',
|
|
|
403: '用户得到授权,但是访问是被禁止的。',
|
|
|
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
|
406: '请求的格式不可得。',
|
|
@@ -37,7 +37,15 @@ const errorHandler = (error: { response: Response }): Response => {
|
|
|
message: `请求错误 ${status}`,
|
|
|
description: errorText,
|
|
|
});
|
|
|
- if ()
|
|
|
+
|
|
|
+ if (response.status === 401) {
|
|
|
+ setTimeout(() => {
|
|
|
+ if (window.location.href.indexOf('/user/login') < 0) {
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
} else if (!response) {
|
|
|
notification.error({
|
|
|
description: '您的网络发生异常,无法连接服务器',
|