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