2023-02-23 17:39:48 +01:00
|
|
|
import { useParams, useHistory } from 'react-router-dom';
|
2023-03-02 21:55:27 +01:00
|
|
|
import { useContext } from 'react';
|
2023-02-23 17:39:48 +01:00
|
|
|
import { useI18nContext } from '../../hooks/useI18nContext';
|
|
|
|
import {
|
|
|
|
downloadDesktopApp,
|
|
|
|
downloadExtension,
|
|
|
|
restartExtension,
|
|
|
|
} from '../../../shared/lib/error-utils';
|
|
|
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
|
2023-03-02 21:55:27 +01:00
|
|
|
import { MetaMetricsContext } from '../../contexts/metametrics';
|
2023-02-23 17:39:48 +01:00
|
|
|
import { renderDesktopError } from './render-desktop-error';
|
|
|
|
|
|
|
|
export default function DesktopError({ forceDisableDesktop }) {
|
|
|
|
const t = useI18nContext();
|
|
|
|
const { errorType } = useParams();
|
|
|
|
const history = useHistory();
|
2023-03-02 21:55:27 +01:00
|
|
|
const trackEvent = useContext(MetaMetricsContext);
|
2023-02-23 17:39:48 +01:00
|
|
|
|
|
|
|
return renderDesktopError({
|
|
|
|
type: errorType,
|
|
|
|
t,
|
|
|
|
isHtmlError: false,
|
|
|
|
history,
|
|
|
|
disableDesktop: () => {
|
|
|
|
forceDisableDesktop();
|
|
|
|
history.push(DEFAULT_ROUTE);
|
|
|
|
},
|
|
|
|
downloadDesktopApp,
|
|
|
|
downloadExtension,
|
|
|
|
restartExtension,
|
2023-03-02 21:55:27 +01:00
|
|
|
trackEvent,
|
2023-02-23 17:39:48 +01:00
|
|
|
});
|
|
|
|
}
|