| | |
| | | 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 ====================== |
| | |
| | | // 将 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 '权限验证失败'; |
| | |
| | | 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 '权限验证失败'; |
| | | } |
| | |
| | | }; |
| | | |
| | | const service = createAxiosInstance(); |
| | | |
| | | export const mainRequest = service; |
| | | |
| | | //#region ====================== 流响应数据 ====================== |