Migrated to nuxt-js frontend framework

This commit is contained in:
2020-04-17 18:57:05 +02:00
parent 8fe229b3d6
commit 1917e2e9fc
32 changed files with 8446 additions and 15 deletions
+28
View File
@@ -0,0 +1,28 @@
import axios from 'axios'
import {mapState} from "vuex";
const state = mapState(['token'])
const apiClient = axios.create({
baseURL: `http://localhost:5000`,
withCredentials: false,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
})
axios.interceptors.request.use(
config => {
const token = state.token;
if (token) {
config.headers['Authorization'] = 'Bearer ' + token;
}
return config;
},
error => {
Promise.reject(error)
});
export default apiClient