wujingjing
2024-11-28 340d40b4d4243c0f3bf82d40b8f570246e39119d
src/utils/request.ts
@@ -8,6 +8,7 @@
import { debounce, decodeFormData } from './util';
import { AUTH_URL, MAIN_URL, SECONDARY_URL } from '/@/constants';
import { Local, LoginInfo, Session } from '/@/utils/storage';
import { isSharePage } from '../stores/chatRoom';
// import JSONbig from 'json-bigint';
//#region ====================== 后端 res.err_code ======================
@@ -48,7 +49,7 @@
            // 将 token 添加到请求报文头中
            config.headers['hswatersession'] = accessSession;
         }
         if (!NO_AUTH_API_LIST.includes(config.url)) {
         if (!NO_AUTH_API_LIST.includes(config.url) && !isSharePage.value) {
            if (!accessSession && config.url !== LOGIN_URL && config.url !== TEL_LOGIN_URL) {
               handleNoAuth(config.url);
               throw '权限验证失败';
@@ -88,7 +89,7 @@
         if (!serveData.json_ok) {
            switch (serveData?.err_code) {
               case ErrorCode.Auth:
                  if (res.config.url !== LOGIN_URL && res.config.url !== TEL_LOGIN_URL) {
                  if (res.config.url !== LOGIN_URL && res.config.url !== TEL_LOGIN_URL && !isSharePage.value) {
                     handleNoAuth();
                     throw '权限验证失败';
                  }
@@ -140,7 +141,6 @@
};
const service = createAxiosInstance();
export const mainRequest = service;
//#region ====================== 流响应数据 ======================