If a user attempts to access a page without being authenticated/have an existing jwt the page should automatically redirect them back to home or login.
Also if a user access lynxmasters.com and has an existing valid token, they should automatically be redirected to their profile page.
If a user accesses / "landing" and has an existing token, they should be redirected to profile view
created () {
this.checkAuthentication()
},
updated () {
this.checkAuthentication()
},
methods: {
checkAuthentication () {
if (localStorage.token is valid) {
this.$router.replace(this.$route.query.redirect || '/profile')
}
},
// ...
}
If a user attempts to access a page without being authenticated/have an existing jwt the page should automatically redirect them back to home or login.
Also if a user access lynxmasters.com and has an existing valid token, they should automatically be redirected to their profile page.
If a user accesses
/
"landing" and has an existing token, they should be redirected toprofile
view