|
|
@ -1,8 +1,8 @@ |
|
|
import axios from 'axios'; |
|
|
import axios from 'axios'; |
|
|
|
|
|
import { $globalStore } from "../common/globalStore" |
|
|
// import router from '@/router/home';
|
|
|
// import router from '@/router/home';
|
|
|
// import {cache} from '@/store/store';
|
|
|
// import {cache} from '@/store/store';
|
|
|
axios.defaults.withCredentials = true |
|
|
axios.defaults.withCredentials = true |
|
|
const { useCommon } = $globalStore; |
|
|
|
|
|
const http = axios.create({ |
|
|
const http = axios.create({ |
|
|
traditional: true, |
|
|
traditional: true, |
|
|
contentType : "application/json", |
|
|
contentType : "application/json", |
|
|
@ -14,8 +14,8 @@ http.interceptors.request.use( |
|
|
config => { |
|
|
config => { |
|
|
if(!config.headers['Content-Type']){ |
|
|
if(!config.headers['Content-Type']){ |
|
|
config.headers['Content-Type'] = 'application/json' |
|
|
config.headers['Content-Type'] = 'application/json' |
|
|
config.headers['Authorization'] = 'Bearer '+ useCommon.token |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
config.headers['token'] = $globalStore.useCommon.token |
|
|
return config |
|
|
return config |
|
|
}, |
|
|
}, |
|
|
err => { |
|
|
err => { |
|
|
|