Configure baseUrl option for axios only once

This commit is contained in:
Jérôme Lebleu
2021-07-12 18:12:00 +02:00
parent bb7d769674
commit 2a9f9fac0e
2 changed files with 7 additions and 2 deletions
-2
View File
@@ -1,4 +1,3 @@
import Vue from 'vue'
import axios from 'axios'
import Cookies from 'js-cookie'
@@ -10,7 +9,6 @@ const _axios = axios.create()
_axios.interceptors.request.use(
function (config) {
// Do something before request is sent
config.baseURL = Vue.prototype.$config.API_BASE_URL
if (store.state.auth.isAuthenticated) {
config.headers['Accept-Language'] = store.state.auth.authUser.language
}