Add axios auth interceptor
This commit is contained in:
parent
24240164ad
commit
5748cc8410
@ -2,6 +2,16 @@ import Vue from "vue";
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
import vuetify from './plugins/vuetify';
|
||||
import axios from "axios"
|
||||
|
||||
// JWT will be injected automatically when available
|
||||
axios.interceptors.request.use(config => {
|
||||
let token = sessionStorage.getItem("jwt")
|
||||
if (token) {
|
||||
config.headers.Authorization = token
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user