import { Button } from '../../common/components/atoms/Button/Button'; import { Link, Navigate, useRouteError } from 'react-router-dom'; import { FunctionComponent } from 'react'; import { Providers } from '../../common/components/templates/Providers/Providers'; import { ErrorAlert } from '../../common/components/atoms/ErrorAlert/ErrorAlert'; import { useAuthenticatedLayoutLogic } from '../../domains/auth/components/AuthenticatedLayout/hooks/useAuthenticatedLayoutLogic/useAuthenticatedLayoutLogic'; import { isErrorWithMessage } from '@ballerine/common'; import { useRedirectToRootUrl } from '@/common/hooks/useRedirectToRootUrl/useRedirectToRootUrl'; export const RootError: FunctionComponent = () => { const error = useRouteError(); const { redirectUnauthenticatedTo, location } = useAuthenticatedLayoutLogic(); const urlToRoot = useRedirectToRootUrl(); if (isErrorWithMessage(error) && error.message === 'Unauthorized (401)') { return ( ); } return (
Something went wrong.
); };