import { FC } from "react";
import { Button, Result } from "antd";
import { FallbackProps } from "react-error-boundary";
import { useTranslation } from "react-i18next";

const ErrorBoundaryFallback: FC<FallbackProps> = ({
  error,
  resetErrorBoundary,
}) => {
  const { t } = useTranslation();
  return (
    <Result
      status={"500"}
      title={t("errors.errorboundary")}
      subTitle={error?.message}
      extra={[
        <Button key="try-again" onClick={resetErrorBoundary}>
          Try again
        </Button>,
      ]}
    />
  );
};

export default ErrorBoundaryFallback;
