优化
This commit is contained in:
@@ -59,7 +59,9 @@ export function registerAuthSessionExpiredHandler(handler: AuthSessionExpiredHan
|
||||
|
||||
http.interceptors.request.use((config) => {
|
||||
const token = localStorage.getItem('cc-admin-token')
|
||||
if (token) {
|
||||
const isAnonymousAuthEndpoint = typeof config.url === 'string'
|
||||
&& ['/auth/login', '/auth/refresh', '/auth/register'].includes(config.url)
|
||||
if (token && !isAnonymousAuthEndpoint) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user