-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Description
What problem does this feature solve?
With a route defined like this:
{
path: '/404',
alias: '*',
name: 'error',
component: Error
}
When a user visit my-site.com/random-inexisting-url
, the url doesn't change and it displays the error page. (this is what we want)
Now, how to to do the same with dynamic routes?
Example:
- there is a route like
my-site.com/pages/:id
- the user visits
my-site.com/pages/inexisting-id
. - the
id
param is used to fetch an API. If the API returns null, there is no automatic redirection to the error page.
It is possible to manually redirect to the /error
page with router.push({ name: 'error' })
or a navigation guard, but it will change the url to /error
.
Is it possible to keep the original url, but still display the error page?
What does the proposed API look like?
something like router.aliasTo({name: 'error' })
Metadata
Metadata
Assignees
Labels
No labels