-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Redirect to 404 Page When Note is Not Found #277
base: main
Are you sure you want to change the base?
Changes from 3 commits
f7aff4a
ad06c92
c88dc16
4316fc4
c6b4cf1
4d54a4c
55bc4e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,19 +181,20 @@ const routes: RouteRecordRaw[] = [ | |
}, | ||
|
||
/** | ||
* 404 page | ||
* error page | ||
*/ | ||
{ | ||
path: '/:pathMatch(.*)*', | ||
path: '/error', | ||
component: ErrorPage, | ||
meta: { | ||
layout: 'fullpage', | ||
pageTitleI18n: 'pages.notFound', | ||
pageTitleI18n: 'pages.error', | ||
discardTabOnLeave: true, | ||
}, | ||
props: { | ||
code: 404, | ||
}, | ||
props: route => ({ | ||
code: route.query.code, | ||
customMessage: route.query.message, | ||
}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 404 page was actually needed (this was a syntax for each unexpected url, that would show 404 we need to create separate /error page, that should have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also better to use route.params for |
||
}, | ||
]; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import DomainError from './Base'; | ||
|
||
/** | ||
* Domain error thrown when some resource is not found | ||
*/ | ||
e11sy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
export default class ApiError extends DomainError { | ||
/** | ||
* Constructor for ApiError error | ||
* @param message - Error message | ||
* @param statusCode - Error status code | ||
*/ | ||
constructor(message: string, public statusCode: number) { | ||
super(message); | ||
this.name = 'ApiError'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see where
?message
is composed. And it's better to use a prop instead of adding a message to the URL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want 'page not found' message right, so on error component it is getting that message from i18n based on error code, if you want custom message then we can pass it as query