All files / src/components AccessDeniedComponent.tsx

83.33% Statements 5/6
100% Branches 2/2
50% Functions 1/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25          66x 3x 3x   3x 3x                            
import React, { ReactElement } from 'react';
import { Button, Result, Space } from 'antd';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
 
const AccessDeniedComponent = (props: { showHomepageButton?: boolean }): ReactElement => {
  const { showHomepageButton } = props;
  const { t } = useTranslation();
 
  const navigate = useNavigate();
  return (<Result
    status="403"
    title={t("403")}
    subTitle={t("Sorry, you are not authorized to access this page.")}
    extra={showHomepageButton && (
      <Space>
        <Button type="primary" onClick={() => navigate("/")}>{t('Homepage')}</Button>
      </Space>
    )
    }
  />);
};
 
export default AccessDeniedComponent;