mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 14:45:20 +00:00
Forwarding error code to 404 page.
This commit is contained in:
parent
67aab22152
commit
ebe60406be
|
@ -46,8 +46,8 @@ server.get('/*', async (req, res) => {
|
|||
|
||||
// Redirect to the 404 if there's an API error
|
||||
if (routeData[0] && routeData[0].error) {
|
||||
console.log(`Route error: ${routeData[0].error}`);
|
||||
return res.redirect('/404');
|
||||
let errCode = routeData[0].error;
|
||||
return res.redirect(`/404?err=${errCode}`);
|
||||
}
|
||||
|
||||
let acceptLang = req.headers['accept-language']
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { Component } from 'inferno';
|
||||
import { i18n } from '../i18next';
|
||||
|
||||
export class NoMatch extends Component<any, any> {
|
||||
private errCode = new URLSearchParams(this.props.location.search).get('err');
|
||||
|
||||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
}
|
||||
|
@ -9,6 +12,11 @@ export class NoMatch extends Component<any, any> {
|
|||
return (
|
||||
<div class="container">
|
||||
<h1>404</h1>
|
||||
{this.errCode && (
|
||||
<h3>
|
||||
{i18n.t('code')}: {i18n.t(this.errCode)}
|
||||
</h3>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue