Client fixes (#8844)

* client: fix router when not authenticated, small fixes for tasks

* load the user only when necessary

* fix tests
This commit is contained in:
Matteo Pagliazzi
2017-06-29 20:49:05 +02:00
committed by GitHub
parent 06de1670b4
commit 33a39d3683
11 changed files with 131 additions and 101 deletions

View File

@@ -3,10 +3,9 @@
require('babel-polyfill');
import Vue from 'vue';
import axios from 'axios';
import AppComponent from './app';
import router from './router';
import generateStore from './store';
import getStore from './store';
import StoreModule from './libs/store';
import './filters/registerGlobals';
import i18n from './libs/i18n';
@@ -26,18 +25,9 @@ Vue.config.productionTip = IS_PRODUCTION;
Vue.use(i18n);
Vue.use(StoreModule);
// TODO just until we have proper authentication
let authSettings = localStorage.getItem('habit-mobile-settings');
if (authSettings) {
authSettings = JSON.parse(authSettings);
axios.defaults.headers.common['x-api-user'] = authSettings.auth.apiId;
axios.defaults.headers.common['x-api-key'] = authSettings.auth.apiToken;
}
export default new Vue({
el: '#app',
router,
store: generateStore(),
store: getStore(),
render: h => h(AppComponent),
});