Answer the question
In order to leave comments, you need to log in
How to make a redirect from a non-existent page?
There is a router setting like this:
{
path: "/users/:id",
name: "User",
component: User,
},
{
path: "/users/:id/edit",
name: "EditUser",
component: EditUser,
},
Answer the question
In order to leave comments, you need to log in
You can determine whether a page exists or not only after querying the database.
Use the beforeCreate or create hook on the page in which to query the database.
You do a check on the result and either display the page based on the data received or do a redirect through the route.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question