| | |
| | | import store from '@/store' |
| | | import { getCookie, getToken } from '@/utils/auth' |
| | | // 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 |
| | | |
| | | }) |
| | | // axios.defaults.withCredentials = true |
| | | |
| | | // request interceptor |
| | | service.interceptors.request.use( |
| | |
| | | // please modify it according to the actual situation |
| | | // config.headers['X-Token'] = getToken() |
| | | // config.headers['Authorization'] = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | config.headers['Cookie'] = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | // config.headers['Cookie'] = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | // document.cookie = 'admin=' + getCookie('admin') + ';navTabId=' + getCookie('navTabId') |
| | | // document.cookie = 'admin' |
| | | } |