|
|
@@ -1,5 +1,5 @@
|
|
|
import type { CustomRequestOptions } from '@/http/types'
|
|
|
-import { useUserStore } from '@/store'
|
|
|
+import { useTokenStore } from '@/store'
|
|
|
import { getEnvBaseUrl } from '@/utils'
|
|
|
import { platform } from '@/utils/platform'
|
|
|
import { stringifyQuery } from './tools/queryString'
|
|
|
@@ -47,8 +47,9 @@ const httpInterceptor = {
|
|
|
...options.header,
|
|
|
}
|
|
|
// 3. 添加 token 请求头标识
|
|
|
- const userStore = useUserStore()
|
|
|
- const { token } = userStore.userInfo as unknown as IUserToken
|
|
|
+ const tokenStore = useTokenStore()
|
|
|
+ const token = tokenStore.validToken
|
|
|
+
|
|
|
if (token) {
|
|
|
options.header.Authorization = `Bearer ${token}`
|
|
|
}
|