|
|
@ -19,6 +19,7 @@ import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' |
|
|
|
import { useUserStore } from '@/store/user/user' |
|
|
|
import { useUserStore } from '@/store/user/user' |
|
|
|
import qs from 'qs' |
|
|
|
import qs from 'qs' |
|
|
|
import _ from 'lodash' |
|
|
|
import _ from 'lodash' |
|
|
|
|
|
|
|
import cookies from 'js-cookie' |
|
|
|
import router from '@/router' |
|
|
|
import router from '@/router' |
|
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
|
const userStore = useUserStore() |
|
|
@ -56,6 +57,11 @@ const err = (err: AxiosError): Promise<AxiosError> => { |
|
|
|
service.interceptors.request.use((config: AxiosRequestConfig<any>) => { |
|
|
|
service.interceptors.request.use((config: AxiosRequestConfig<any>) => { |
|
|
|
config.headers && (config.headers.sessionId = userStore.getSessionId) |
|
|
|
config.headers && (config.headers.sessionId = userStore.getSessionId) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sIdCookie = cookies.get('sessionId') |
|
|
|
|
|
|
|
const language = cookies.get('language') |
|
|
|
|
|
|
|
config.headers = config.headers || {} |
|
|
|
|
|
|
|
if (language) config.headers.language = language |
|
|
|
|
|
|
|
if (sIdCookie) config.headers.sessionId = sIdCookie |
|
|
|
return config |
|
|
|
return config |
|
|
|
}, err) |
|
|
|
}, err) |
|
|
|
|
|
|
|
|
|
|
|