mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
21 lines
672 B
TypeScript
21 lines
672 B
TypeScript
import { useNavigate, useRouteError } from 'react-router';
|
||
|
||
import { Button } from '@/components/control1';
|
||
import { InfoError } from '@/components/info-error';
|
||
|
||
export function ErrorFallback() {
|
||
const error = useRouteError();
|
||
const router = useNavigate();
|
||
|
||
function resetErrorBoundary() {
|
||
Promise.resolve(router('/')).catch(console.error);
|
||
}
|
||
return (
|
||
<div className='flex flex-col gap-3 my-3 items-center antialiased' role='alert'>
|
||
<h1 className='my-2'>Что-то пошло не так!</h1>
|
||
<Button onClick={resetErrorBoundary} text='Вернуться на главную' />
|
||
<InfoError error={error as Error} />
|
||
</div>
|
||
);
|
||
}
|