Skip to content

Commit

Permalink
✨ put auth header before axios request
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed May 6, 2019
1 parent bf6e469 commit 3013bbe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libs/fetch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from "axios";
import store from '../store'

let fetch = axios.create({
baseURL: process.env.VUE_APP_URL,
Expand All @@ -8,8 +9,8 @@ let fetch = axios.create({
});

fetch.interceptors.request.use(config => {
if (true) {
config.headers.Authorization = "token";
if (store.state.account.token) {
config.headers.Authorization = store.state.account.token;
}
return config;
});
Expand Down

0 comments on commit 3013bbe

Please sign in to comment.