error-boundary-fallback.tsx 527 B

123456789101112131415161718192021
  1. import { FC, ReactNode } from 'react'
  2. import { Alert } from 'react-bootstrap'
  3. import { useTranslation } from 'react-i18next'
  4. export const ErrorBoundaryFallback: FC<{ modal?: ReactNode }> = ({
  5. children,
  6. modal,
  7. }) => {
  8. return (
  9. <div className="error-boundary-alert">
  10. <Alert bsStyle="danger">{children || <DefaultContent />}</Alert>
  11. {modal}
  12. </div>
  13. )
  14. }
  15. const DefaultContent = () => {
  16. const { t } = useTranslation()
  17. return <p>{`${t('generic_something_went_wrong')}. ${t('please_refresh')}`}</p>
  18. }