fix: id兼容, 通知入口
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m0s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m0s
This commit is contained in:
@@ -4,6 +4,7 @@ import { useUserStore } from '@/store/modules/user'
|
||||
import { ApiStatus } from './status'
|
||||
import type { RequestOptions, ErrorMessageMode } from '@/types/api'
|
||||
import { normalizeApiError } from '@/utils/business/apiError'
|
||||
import { syncCompatibleIdFields } from '@/utils/business/id'
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
timeout: 15000, // 请求超时时间(毫秒)
|
||||
@@ -90,6 +91,9 @@ const processQueue = (error: any, token: string | null = null) => {
|
||||
// 响应拦截器
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
// 兼容历史接口返回的 ID 与新接口返回的 id。
|
||||
syncCompatibleIdFields(response.data)
|
||||
|
||||
// 401 未授权 - 尝试刷新 token
|
||||
if (response.data.code === ApiStatus.unauthorized) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
Reference in New Issue
Block a user