fix: wait with redirect until route name is available
This commit is contained in:
parent
60ef07da0f
commit
eec02a55a4
1 changed files with 16 additions and 5 deletions
|
@ -27,12 +27,23 @@ export default {
|
||||||
logoUrl,
|
logoUrl,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
computed: {
|
||||||
this.redirectToHome()
|
routeName() {
|
||||||
|
return this.$route.name
|
||||||
},
|
},
|
||||||
computed: mapState({
|
...mapState({
|
||||||
motd: state => state.config.motd,
|
motd: state => state.config.motd,
|
||||||
}),
|
}),
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
routeName: {
|
||||||
|
handler(routeName) {
|
||||||
|
if (!routeName) return
|
||||||
|
this.redirectToHome()
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
redirectToHome() {
|
redirectToHome() {
|
||||||
// Check if the user is already logged in and redirect them to the home page if not
|
// Check if the user is already logged in and redirect them to the home page if not
|
||||||
|
|
Loading…
Reference in a new issue