|
@@ -1,14 +1,15 @@
|
|
|
import axios from 'axios'
|
|
|
import { Message } from 'element-ui'
|
|
|
-import store from '@/store'
|
|
|
-import { getToken } from '@/utils/auth'
|
|
|
+// import store from '@/store'
|
|
|
+// import { getToken } from '@/utils/auth'
|
|
|
import { loginUrl } from '@/api/user.js'
|
|
|
|
|
|
// create an axios instance
|
|
|
const service = axios.create({
|
|
|
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
|
|
// withCredentials: true, // send cookies when cross-domain requests
|
|
|
- timeout: 5000 // request timeout
|
|
|
+ timeout: 5000, // request timeout
|
|
|
+ withCredentials: true
|
|
|
})
|
|
|
|
|
|
axios.defaults.withCredentials = true
|
|
@@ -18,12 +19,12 @@ service.interceptors.request.use(
|
|
|
config => {
|
|
|
// do something before request is sent
|
|
|
|
|
|
- if (store.getters.token) {
|
|
|
- // let each request carry token
|
|
|
- // ['X-Token'] is a custom headers key
|
|
|
- // please modify it according to the actual situation
|
|
|
- config.headers['X-Token'] = getToken()
|
|
|
- }
|
|
|
+ // if (store.getters.token) {
|
|
|
+ // // let each request carry token
|
|
|
+ // // ['X-Token'] is a custom headers key
|
|
|
+ // // please modify it according to the actual situation
|
|
|
+ // config.headers['X-Token'] = getToken()
|
|
|
+ // }
|
|
|
return config
|
|
|
},
|
|
|
error => {
|