!26 request.js 加默认token

Merge pull request !26 from 覃杰/auto-8533815-develop-1629701081563
This commit is contained in:
覃杰 2021-08-23 06:45:17 +00:00 committed by Gitee
commit 5994e07572
1 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import store from '@/store'
import storage from 'store' import storage from 'store'
import notification from 'ant-design-vue/es/notification' import notification from 'ant-design-vue/es/notification'
import { VueAxios } from './axios' 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 DATA_OWNER = 1
const SUCCESS_CODE = 'ok' const SUCCESS_CODE = 'ok'
@ -54,6 +54,7 @@ request.interceptors.request.use(config => {
// 让每个请求携带自定义 token 请根据实际情况自行修改 // 让每个请求携带自定义 token 请根据实际情况自行修改
if (token) { if (token) {
config.headers[ACCESS_TOKEN] = token config.headers[ACCESS_TOKEN] = token
config.headers[TOKEN_NAME] = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdhYTViMGZiLTkyOWQtNDhhZS04ODU1LWJkNzM5MjdlOTNiZCJ9.CZzowaB-w2krGpNttPZBNLfq1mw775Lh-sx1K8onfgSwNzA6bw-P7CqC4vgH29xjDv3ey4zEFDzV9pHnrAGrDA'
} }
if (config.method === 'post') { if (config.method === 'post') {
if (!config.data) { if (!config.data) {