forked from natuka/web.puabadge.com
单图徽章代码提交
This commit is contained in:
1 parent
ad93fb5fa0
commit
d95c0fbf2e
9 files changed
+524
-185
No files matched your search
@@ -49,11 +49,12 @@ const errorHandler = (error: RequestError): Promise<any> => {
|
||||
|
||||
// 请求拦截器
|
||||
const requestHandler = (config: InternalAxiosRequestConfig): InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig> => {
|
||||
const savedToken = localStorage.get(STORAGE_TOKEN_KEY)
|
||||
// const savedToken = localStorage.get(STORAGE_TOKEN_KEY)
|
||||
// 如果 token 存在
|
||||
const code = localStorage.get('code')
|
||||
// 让每个请求携带自定义 token, 请根据实际情况修改
|
||||
if (savedToken)
|
||||
config.headers[REQUEST_TOKEN_KEY] = savedToken
|
||||
if (code)
|
||||
config.headers['Authorization'] = code
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user