增加抖音美团核销
This commit is contained in:
@@ -2,10 +2,12 @@ import axios from 'axios'
|
||||
import router from '@/router/routers'
|
||||
import { Notification } from 'element-ui'
|
||||
import store from '../store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Config from '@/settings'
|
||||
import Cookies from 'js-cookie'
|
||||
import { setToken } from '@/utils/globalCancelToken.js'
|
||||
function getToken() {
|
||||
return localStorage.getItem('bausertoken')
|
||||
}
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/',
|
||||
@@ -17,7 +19,7 @@ const service = axios.create({
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
if (getToken()) {
|
||||
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
config.headers['bausertoken'] = getToken()
|
||||
}
|
||||
config.headers['Content-Type'] = 'application/json'
|
||||
// 添加可取消请求配置
|
||||
@@ -32,7 +34,37 @@ service.interceptors.request.use(
|
||||
// response 拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
return response.data
|
||||
const data = response.data
|
||||
console.log(data)
|
||||
if (data.code == 0) {
|
||||
Notification.error({
|
||||
title: data.msg,
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
if (data.code == 439) {
|
||||
Notification.error({
|
||||
title: '请登录',
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
if (data.code == 4399) {
|
||||
Notification.error({
|
||||
title: data.msg,
|
||||
duration: 5000
|
||||
})
|
||||
return data
|
||||
}
|
||||
if (data.code == 1&&!data.data) {
|
||||
// Notification.success({
|
||||
// title: data.msg,
|
||||
// duration: 5000
|
||||
// })
|
||||
return true
|
||||
}
|
||||
return data.data
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
|
||||
Reference in New Issue
Block a user