chore: cleanup route check

This commit is contained in:
Daan Wijns 2021-02-17 08:30:19 +01:00
parent f845c0a802
commit a5e2b4a31f

View file

@ -29,6 +29,9 @@ export default {
...mapGetters(['getAuthenticated']), ...mapGetters(['getAuthenticated']),
isAuthenticated() { isAuthenticated() {
return this.getAuthenticated() return this.getAuthenticated()
},
onLoginPage() {
return this.$router.currentRoute.name.includes('login')
} }
}, },
created() { created() {
@ -42,10 +45,7 @@ export default {
const authenticated = res === 'Ok.' const authenticated = res === 'Ok.'
this.$store.commit('LOGIN', authenticated) this.$store.commit('LOGIN', authenticated)
this.$store.commit('updateMainData') this.$store.commit('updateMainData')
if ( if (!authenticated && !this.onLoginPage) return this.$router.push('login')
!authenticated &&
!this.$router.currentRoute.name.includes('login')
) this.$router.push('login')
}, },
checkDeviceDarkTheme() { checkDeviceDarkTheme() {
if (this.webuiSettings.useDeviceDarkMode) { if (this.webuiSettings.useDeviceDarkMode) {