mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 08:13:27 +01:00
30 lines
1002 B
TypeScript
30 lines
1002 B
TypeScript
import { useRouteError } from 'react-router-dom';
|
|
import { Button } from './core/Button';
|
|
import { Heading } from './core/Heading';
|
|
import { VStack } from './core/Stacks';
|
|
|
|
export default function RouteError() {
|
|
const error = useRouteError();
|
|
const stringified = JSON.stringify(error);
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const message = (error as any).message ?? stringified;
|
|
return (
|
|
<div className="flex items-center justify-center h-full">
|
|
<VStack space={5} className="max-w-[30rem] !h-auto">
|
|
<Heading>Route Error 🔥</Heading>
|
|
<pre className="text-sm select-auto cursor-text bg-gray-100 p-3 rounded whitespace-normal">
|
|
{message}
|
|
</pre>
|
|
<VStack space={2}>
|
|
<Button to="/" color="primary">
|
|
Go Home
|
|
</Button>
|
|
<Button color="secondary" onClick={() => window.location.reload()}>
|
|
Refresh
|
|
</Button>
|
|
</VStack>
|
|
</VStack>
|
|
</div>
|
|
);
|
|
}
|