Properly cast null value from session storage

This commit is contained in:
Björn Fromme
2018-11-27 11:17:10 +01:00
parent 71a454c716
commit 60c76dc717
3 changed files with 3 additions and 3 deletions
@@ -8,7 +8,7 @@ const guard = (to, from, next) => {
if (store.state.loading) { if (store.state.loading) {
next(false); next(false);
} else if (store.state.loggedIn) { } else if (store.state.loggedIn) {
if (to.meta.requiresTeamer && !store.state.teamer) { if (to.meta.requiresTeamer && !store.state.isTeamer) {
next(false); next(false);
} else { } else {
next(); next();
@@ -27,7 +27,7 @@ export default new Vuex.Store({
config: config, config: config,
loading: false, loading: false,
loggedIn: !!sessionStorage.getItem('token'), loggedIn: !!sessionStorage.getItem('token'),
teamer: !!sessionStorage.getItem('teamerId'), isTeamer: JSON.parse(sessionStorage.getItem('teamerId')) !== null,
countries: [], countries: [],
abilities: [], abilities: [],
timeFrames: [], timeFrames: [],
@@ -63,7 +63,7 @@
return this.$store.state.loggedIn; return this.$store.state.loggedIn;
}, },
isTeamer () { isTeamer () {
return this.$store.state.teamer; return this.$store.state.isTeamer;
}, },
loaderUrl () { loaderUrl () {
return this.$store.state.config.loaderUrl; return this.$store.state.config.loaderUrl;