!26 request.js 加默认token
Merge pull request !26 from 覃杰/auto-8533815-develop-1629701081563
This commit is contained in:
commit
5994e07572
|
@ -3,7 +3,7 @@ import store from '@/store'
|
|||
import storage from 'store'
|
||||
import notification from 'ant-design-vue/es/notification'
|
||||
import { VueAxios } from './axios'
|
||||
import { ACCESS_TOKEN, LOGIN_TOKEN } from '@/store/mutation-types'
|
||||
import { ACCESS_TOKEN, LOGIN_TOKEN, TOKEN_NAME } from '@/store/mutation-types'
|
||||
|
||||
const DATA_OWNER = 1
|
||||
const SUCCESS_CODE = 'ok'
|
||||
|
@ -54,6 +54,7 @@ request.interceptors.request.use(config => {
|
|||
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
||||
if (token) {
|
||||
config.headers[ACCESS_TOKEN] = token
|
||||
config.headers[TOKEN_NAME] = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdhYTViMGZiLTkyOWQtNDhhZS04ODU1LWJkNzM5MjdlOTNiZCJ9.CZzowaB-w2krGpNttPZBNLfq1mw775Lh-sx1K8onfgSwNzA6bw-P7CqC4vgH29xjDv3ey4zEFDzV9pHnrAGrDA'
|
||||
}
|
||||
if (config.method === 'post') {
|
||||
if (!config.data) {
|
||||
|
@ -83,7 +84,7 @@ request.interceptors.response.use((response) => {
|
|||
|
||||
const installer = {
|
||||
vm: {},
|
||||
install (Vue) {
|
||||
install(Vue) {
|
||||
Vue.use(VueAxios, request)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue