auto-detect initial app state and redirect user

pull/1/head
Thomas Ballmann 3 years ago
parent 24fde4ae1f
commit 59f90f6ef4

@ -40,8 +40,28 @@
},
},
created () {
// load
Promise.all([this.loadStats(), this.loadSettings()]).then(() => {
// init app
let goto
const setupFinished = true // TODO
const wifiConnected = this.stats.wifi.connected
// only on initial navigation
if (!setupFinished) {
if (this.$route.path !== '/setup/start') {
goto = '/setup/start'
}
} else if (!wifiConnected) {
if (this.$route.path !== '/wifi') {
goto = '/wifi'
}
}
if (goto) {
this.$router.push(goto)
}
// initialization done
this.isLoading = false
})
},

Loading…
Cancel
Save