Move auth type checks to computed properties
This commit is contained in:
parent
8dd6ce4a86
commit
7ed7d1ece2
17
src/App.vue
17
src/App.vue
|
@ -3,9 +3,9 @@
|
||||||
<template v-if="online">
|
<template v-if="online">
|
||||||
<!-- This is a workaround to get the sw to "see" the to-be-cached version of the offline background image -->
|
<!-- This is a workaround to get the sw to "see" the to-be-cached version of the offline background image -->
|
||||||
<div class="offline" style="height: 0;width: 0;"></div>
|
<div class="offline" style="height: 0;width: 0;"></div>
|
||||||
<top-navigation v-if="userAuthenticated && (userInfo && userInfo.type === authTypes.USER)"/>
|
<top-navigation v-if="authUser"/>
|
||||||
<content-auth v-if="userAuthenticated && (userInfo && userInfo.type === authTypes.USER)"/>
|
<content-auth v-if="authUser"/>
|
||||||
<content-link-share v-else-if="userAuthenticated && (userInfo && userInfo.type === authTypes.LINK_SHARE)"/>
|
<content-link-share v-else-if="authLinkShare"/>
|
||||||
<content-no-auth v-else/>
|
<content-no-auth v-else/>
|
||||||
<notification/>
|
<notification/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -49,7 +49,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentDate: new Date(),
|
currentDate: new Date(),
|
||||||
authTypes: authTypes,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
|
@ -123,11 +122,19 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: {
|
||||||
|
authUser() {
|
||||||
|
return this.userAuthenticated && (this.userInfo && this.userInfo.type === authTypes.USER)
|
||||||
|
},
|
||||||
|
authLinkShare() {
|
||||||
|
return this.userAuthenticated && (this.userInfo && this.userInfo.type === authTypes.LINK_SHARE)
|
||||||
|
},
|
||||||
|
...mapState({
|
||||||
userInfo: state => state.auth.info,
|
userInfo: state => state.auth.info,
|
||||||
userAuthenticated: state => state.auth.authenticated,
|
userAuthenticated: state => state.auth.authenticated,
|
||||||
online: ONLINE,
|
online: ONLINE,
|
||||||
keyboardShortcutsActive: KEYBOARD_SHORTCUTS_ACTIVE,
|
keyboardShortcutsActive: KEYBOARD_SHORTCUTS_ACTIVE,
|
||||||
}),
|
}),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Reference in New Issue
Block a user