|
@@ -6,7 +6,7 @@ import { notification } from 'ant-design-vue';
|
|
|
import mockAdapter from './mock';
|
|
import mockAdapter from './mock';
|
|
|
import { getToken } from './tools';
|
|
import { getToken } from './tools';
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+let key = '';
|
|
|
const request = createAlova({
|
|
const request = createAlova({
|
|
|
baseURL: '/manager/',
|
|
baseURL: '/manager/',
|
|
|
statesHook: VueHook,
|
|
statesHook: VueHook,
|
|
@@ -35,7 +35,8 @@ const request = createAlova({
|
|
|
? { total, data: rows }
|
|
? { total, data: rows }
|
|
|
: data;
|
|
: data;
|
|
|
} else if ( code === 401 ) {
|
|
} else if ( code === 401 ) {
|
|
|
- return await router.replace('/login');
|
|
|
|
|
|
|
+ key = code;
|
|
|
|
|
+ await router.replace('/login');
|
|
|
} else if ( warn ) {
|
|
} else if ( warn ) {
|
|
|
ignoreException = true;
|
|
ignoreException = true;
|
|
|
notification.warning({
|
|
notification.warning({
|
|
@@ -48,9 +49,9 @@ const request = createAlova({
|
|
|
} catch ( e: any ) {
|
|
} catch ( e: any ) {
|
|
|
if ( !ignoreException && !method.meta?.ignoreException ) {
|
|
if ( !ignoreException && !method.meta?.ignoreException ) {
|
|
|
notification.error({
|
|
notification.error({
|
|
|
- message: method.url,
|
|
|
|
|
|
|
+ message: key ? '请重新登录' : method.url,
|
|
|
description: e?.message,
|
|
description: e?.message,
|
|
|
- key: method.url,
|
|
|
|
|
|
|
+ key: key || method.url,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
throw e;
|
|
throw e;
|