修复接单端过期会话重复请求

This commit is contained in:
yml2213
2026-08-30 17:32:34 +08:00
parent 535cefd4de
commit ffb71f2276
6 changed files with 117 additions and 11 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import axios from 'axios'
import { clearAdminSession, getAdminToken } from '@/utils/admin-auth'
import { isWorkerSite } from '@/utils/site'
import { clearWorkerSession, getWorkerToken } from '@/utils/worker-auth'
import { expireWorkerSession, getWorkerToken } from '@/utils/worker-auth'
export interface ApiEnvelope<T> {
code: number
@@ -73,7 +73,7 @@ http.interceptors.response.use(
const errorCode = String(error?.response?.data?.errorCode || '').trim()
if (status === 401 && shouldClearWorkerSession(errorCode)) {
clearWorkerSession()
expireWorkerSession()
if (isWorkerSite() && window.location.pathname !== '/') {
window.location.replace('/')