blob: 95bc78df413e964f3ff25f0fc07b33b66aaff014 (
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
|
import React from 'react';
import { Center } from '@mantine/core';
// TODO: make a better page
function getMessage(code, location) {
const statusCode =
parseInt(code || new URLSearchParams(location?.search).get('code')) || 404;
switch (statusCode) {
case 403:
return 'Sorry, you are not authorized to view this page.';
case 404:
return 'Sorry, the page you were looking for does not exist.';
case 500:
return 'Oops... something went wrong.';
default:
return 'Unknown error - really, I have no idea what is going on here.';
}
}
export function Error({ code, location }) {
const message = getMessage(code, location);
return <Center sx={{ minHeight: '89px' }}>{message}</Center>;
}
|