mirror of https://github.com/halo-dev/halo-admin
Comlete token settle before requesting
parent
26cd673f73
commit
952213649c
|
@ -10,7 +10,6 @@ const user = {
|
||||||
roles: [],
|
roles: [],
|
||||||
info: {}
|
info: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_TOKEN: (state, token) => {
|
SET_TOKEN: (state, token) => {
|
||||||
Vue.ls.set(ACCESS_TOKEN, token)
|
Vue.ls.set(ACCESS_TOKEN, token)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import NProgress from 'nprogress'
|
||||||
import 'nprogress/nprogress.css'
|
import 'nprogress/nprogress.css'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: process.env.NODE_ENV === 'production' ? '' : 'http://localhost:8090',
|
baseURL: process.env.NODE_ENV === 'production' ? '' : 'http://localhost:8090',
|
||||||
|
@ -14,6 +15,11 @@ service.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
// TODO set token
|
// TODO set token
|
||||||
|
const token = store.getters.token
|
||||||
|
Vue.$log.debug('Got token from store', token)
|
||||||
|
if (token && token.access_token) {
|
||||||
|
config.headers['Admin-Authorization'] = token.access_token
|
||||||
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
|
Loading…
Reference in New Issue