Explorar el Código

Merge tag '2.2.0' into develop

cc12458 hace 5 meses
padre
commit
4f3f017a18
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      src/request/alova.ts

+ 5 - 4
src/request/alova.ts

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