| | |
| | | import type { AxiosInstance, AxiosRequestConfig } from 'axios'; |
| | | import axios from 'axios'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { NO_AUTH_API_LIST } from '../api/ai/chat'; |
| | | import { LOGIN_URL, TEL_LOGIN_URL } from '../api/ai/user'; |
| | | import emitter from './mitt'; |
| | | import { debounce } from './util'; |
| | | import { AUTH_URL, MAIN_URL, SECONDARY_URL } from '/@/constants'; |
| | | import { Local, LoginInfo, Session } from '/@/utils/storage'; |
| | | import { LOGIN_URL } from '../api/ai/user'; |
| | | import { NO_AUTH_API_LIST } from '../api/ai/chat'; |
| | | // import JSONbig from 'json-bigint'; |
| | | |
| | | //#region ====================== 后端 res.err_code ====================== |
| | |
| | | // 将 token 添加到请求报文头中 |
| | | config.headers['hswatersession'] = accessSession; |
| | | } else { |
| | | if (config.url !== LOGIN_URL) { |
| | | if (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) { |
| | | if (res.config.url !== LOGIN_URL && res.config.url !== TEL_LOGIN_URL) { |
| | | handleNoAuth(); |
| | | throw '权限验证失败'; |
| | | } |
| | |
| | | ElMessage.error('内部错误!'); |
| | | throw '内部错误'; |
| | | } |
| | | |
| | | } |
| | | return res.data; |
| | | }, |