Once a user has logged in for the first time, they are directed to the CreateProfile page where they can enter their profile information. I want to restrict access to this page so that if the user manually types the URL into their browser (e.g. www.myproject.com/createProfile), they will be redirected and unable to access it.
How can I ensure that only redirection from the login page allows access to the CreateProfile page? If a user attempts to access it directly via URL, they should be redirected to a 404 error page.
The current route setup for CreateProfile is as follows:
{
path: '/createprofile',
name: 'CreateProfile',
component: CreateProfile,
beforeEnter: (to, from, next) => {
if (store.getters.getUserStatus == true) {
next()
} else {
next({ name: 'Login' })
}
}
}
Thank you!