From c6c98d6aa0aae76e45e824bd231034c6ef2f2012 Mon Sep 17 00:00:00 2001 From: jedi Date: Thu, 5 Dec 2019 22:26:45 +0100 Subject: [PATCH] postpone the .env problem --- .gitignore | 2 ++ src/store/index.js | 13 +++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 587c816..db5b83e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ yarn.lock *.njsproj *.sln *.sw? + +src/store/auth.js \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index a1c4557..4a552a4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,8 +4,11 @@ import axios from 'axios'; //import * as _ from 'lodash/fp'; import router from '../router'; +import getAuth from './auth'; + Vue.use(Vuex); + const store = new Vuex.Store({ state: { events: Array, @@ -34,10 +37,7 @@ const store = new Vuex.Store({ actions: { async loadEvents({ commit }) { const resp = await axios.get('https://c3lf.de/api/1/events', { - auth: { - username: process.env.VUE_APP_CONFIG_API_USER, - password: process.env.VUE_APP_CONFIG_API_PASSWORD - } + auth: getAuth(), }); commit('replaceEvents', resp.data); @@ -48,10 +48,7 @@ const store = new Vuex.Store({ }, async loadEventItems({ commit, state }) { const resp = await axios.get(`https://c3lf.de/api/1/${state.route.params.event}/items`, { - auth: { - username: process.env.VUE_APP_CONFIG_API_USER, - password: process.env.VUE_APP_CONFIG_API_PASSWORD - } + auth: getAuth(), }); console.log(resp.data);