第 5 阶段:纠纷、通知与后台-2
This commit is contained in:
@@ -6,7 +6,9 @@ export const apiClient = axios.create({
|
||||
})
|
||||
|
||||
apiClient.interceptors.request.use((config) => {
|
||||
const token = localStorage.getItem('access_token')
|
||||
const url = config.url || ''
|
||||
const tokenKey = url.startsWith('/admin') ? 'admin_access_token' : 'access_token'
|
||||
const token = localStorage.getItem(tokenKey)
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user