|
|
|
@ -3,6 +3,7 @@ import Vue from 'vue' |
|
|
|
import promise from 'es6-promise' |
|
|
|
import axios from 'axios' |
|
|
|
import store from '@/store/index' |
|
|
|
import router from '../router' |
|
|
|
// import localStorage from '../storage/localStorage'
|
|
|
|
import Cookie from 'js-cookie' |
|
|
|
promise.polyfill() |
|
|
|
@ -31,6 +32,22 @@ service.interceptors.request.use(config => { |
|
|
|
if (Cookie.get('token')) { |
|
|
|
config.headers['Authorization'] = Cookie.get('token') |
|
|
|
} |
|
|
|
|
|
|
|
var fullUrl = window.location.search; |
|
|
|
if (fullUrl.indexOf("?") != -1) { |
|
|
|
fullUrl = fullUrl.substring(1); |
|
|
|
var paramStrs = fullUrl.split("&"); |
|
|
|
for(let i=0;i<paramStrs.length;i++){ |
|
|
|
const newStrs = paramStrs[i].split("="); |
|
|
|
if(newStrs[0] === 'project'){ |
|
|
|
config.headers['project'] = newStrs[1] |
|
|
|
return config |
|
|
|
} |
|
|
|
} |
|
|
|
config.headers['project'] = '' |
|
|
|
}else{ |
|
|
|
config.headers['project'] = '' |
|
|
|
} |
|
|
|
return config |
|
|
|
}, error => { |
|
|
|
return Promise.reject(error) |
|
|
|
|