Remove superfluous getters from store

This commit is contained in:
Björn Fromme
2018-10-17 08:00:35 +02:00
parent 3b6b73cf91
commit f26efcb232
7 changed files with 9 additions and 15 deletions
@@ -5,9 +5,9 @@ import store from './_store';
Vue.use(VueRouter); Vue.use(VueRouter);
const guard = (to, from, next) => { const guard = (to, from, next) => {
if (store.getters.isLoading) { if (store.state.loading) {
next(false); next(false);
} else if (store.getters.isLoggedIn) { } else if (store.state.loggedIn) {
next(); next();
} else { } else {
next({ name: 'login' }); next({ name: 'login' });
@@ -26,7 +26,7 @@ export default new VueRouter({
path: '/', path: '/',
component: Login, component: Login,
beforeEnter (from, to, next) { beforeEnter (from, to, next) {
if (!store.getters.isLoggedIn) { if (!store.state.loggedIn) {
next(); next();
} else { } else {
next({ name: 'address' }); next({ name: 'address' });
@@ -152,12 +152,6 @@ export default new Vuex.Store({
} }
}, },
getters: { getters: {
isLoading: state => {
return state.loading;
},
isLoggedIn: state => {
return state.loggedIn;
},
authToken () { authToken () {
return sessionStorage.getItem('token') return sessionStorage.getItem('token')
} }
@@ -150,7 +150,7 @@
return this.$store.state.countries; return this.$store.state.countries;
}, },
loading () { loading () {
return this.$store.getters.isLoading; return this.$store.state.loading;
} }
} }
} }
@@ -39,13 +39,13 @@
}, },
computed: { computed: {
isLoggedIn () { isLoggedIn () {
return this.$store.getters.isLoggedIn; return this.$store.state.loggedIn;
}, },
loaderUrl () { loaderUrl () {
return this.$store.state.config.loaderUrl; return this.$store.state.config.loaderUrl;
}, },
loading () { loading () {
return this.$store.getters.isLoading; return this.$store.state.loading;
} }
}, },
created () { created () {
@@ -83,7 +83,7 @@
return this.$store.state.config.loaderUrl; return this.$store.state.config.loaderUrl;
}, },
loading () { loading () {
return this.$store.getters.isLoading; return this.$store.state.loading;
} }
} }
} }
@@ -93,7 +93,7 @@
return this.$store.state.config.loaderUrl; return this.$store.state.config.loaderUrl;
}, },
loading () { loading () {
return this.$store.getters.isLoading; return this.$store.state.loading;
} }
} }
} }
@@ -60,7 +60,7 @@
return this.$store.state.config.loaderUrl; return this.$store.state.config.loaderUrl;
}, },
loading () { loading () {
return this.$store.getters.isLoading; return this.$store.state.loading;
} }
} }
} }