修复接单端过期会话重复请求
This commit is contained in:
@@ -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('/')
|
||||
|
||||
Reference in New Issue
Block a user