wujingjing
2024-08-29 fe25566c53e2c5ac9c8a9e3b262a0affda53328a
src/utils/request.ts
@@ -44,7 +44,7 @@
   // 增加loading 如果pending请求数量等于1,弹出loading, 防止重复弹出
   requestNum++;
   if (requestNum == 1) {
       loadingInstance = ElLoadingService({
      loadingInstance = ElLoadingService({
         text: '加载中...',
         target: '.layout-parent',
      });
@@ -61,6 +61,7 @@
   // 添加请求拦截器
   request.interceptors.request.use(
      (config) => {
         console.log('🚀 ~ config:', config);
         // 获取本地的 token
         const accessSession = Local.get(accessSessionKey);
         const { loading = true, noAuth = false, handleFail = true } = config as ExtraConfig;
@@ -72,7 +73,7 @@
            config.headers['hswatersession'] = accessSession;
         }
         if (!noAuth) {
            if (!accessSession ) {
            if (!accessSession) {
               handleNoAuth();
            }
         }
@@ -111,7 +112,7 @@
            switch (serveData?.err_code) {
               case ErrorCode.Auth:
                  handleNoAuth();
                     throw '权限验证失败';
                  throw '权限验证失败';
                  break;
               case ErrorCode.Exception:
                  ElMessage.error('内部错误!');