| | |
| | | /*
|
| | | * @Date: 2022-11-09 12:37:25
|
| | | * @LastEditors: Sneed
|
| | | * @LastEditTime: 2024-01-16 23:18:23
|
| | | * @LastEditTime: 2024-01-17 23:18:49
|
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/utils/ajax.js
|
| | | */
|
| | | import axios from 'axios'
|
| | |
| | | // request拦截器
|
| | | service.interceptors.request.use(config => {
|
| | | config.url = `${URL_CFG.BASE_URL}${config.url}`
|
| | | if (store.getters.token) {
|
| | | console.log('>>>>>>>>>>>???????????',getToken().value)
|
| | | if (getToken().value) {
|
| | | config.headers['mdc-token'] = getToken().value // 让每个请求携带自定义token 请根据实际情况自行修改
|
| | | }
|
| | | if (config.mytype == 'json') {
|
| | | config.headers = {
|
| | | 'Content-Type':'application/json; charset=UTF-8'
|
| | | 'Content-Type':'application/json; charset=UTF-8',
|
| | | ['mdc-token']: getToken().value
|
| | | }
|
| | | }
|
| | | config.transformRequest = [function(data) {
|