blob: a649e252b3c0fc6d08e43f5b7278280dc2818189 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { useRouteError } from 'react-router-dom';
import Card from '../components/Card';
const LandingPage = () => {
const error: any = useRouteError() || {};
let title, message, isUnexpected = false;
if (error.status === 404) {
title = 'Not Found';
message = 'The requested page could not be found.';
} else {
title = 'Error';
message = error.message || error.statusText;
isUnexpected = true;
}
return (
<>
<div>
<Card title={title}>
{isUnexpected && <strong>An error occurred:</strong>}
<p>
{message}
</p>
</Card>
</div>
</>
);
};
export default LandingPage;
|