|
@@ -1,6 +1,6 @@
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
-import { ACCESS_TOKEN } from '@/utils/constants'
|
|
|
|
|
|
+import { ACCESS_TOKEN, TOKEN_PREFIX } from '@/utils/constants'
|
|
import { useUserStore } from '@/stores/user'
|
|
import { useUserStore } from '@/stores/user'
|
|
import { logout } from '@/utils/micro'
|
|
import { logout } from '@/utils/micro'
|
|
|
|
|
|
@@ -37,7 +37,7 @@ const errorHandler = (error: any) => {
|
|
|
|
|
|
request.interceptors.request.use(config => {
|
|
request.interceptors.request.use(config => {
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
- const token = 'Bearer ' + userStore.token
|
|
|
|
|
|
+ const token = TOKEN_PREFIX + userStore.token
|
|
config.headers = config.headers || {}
|
|
config.headers = config.headers || {}
|
|
|
|
|
|
if (token) {
|
|
if (token) {
|