import { buttonMessages , errorMessages } from '@client/i18n/messages' ; import { ErrorToastNotification } from '@opencrvs/components/lib/interface' ; import * as React from 'react' ; import { injectIntl , WrappedComponentProps } from 'react-intl' ; export enum NOTIFICATION_TYPE { ERROR } const notificationActionButtonHandler = ( ) => { window . location . reload ( ) ; } ; function getErrorNotification ( intl ) { return ( < ErrorToastNotification retryButtonText = { intl . formatMessage ( buttonMessages . retry ) } retryButtonHandler = { notificationActionButtonHandler } > { intl . formatMessage ( errorMessages . pageLoadFailed ) } < /ErrorToastNotification>); } export const ToastNotification = injectIntl ( ( props ) => { const { intl , type } = props ; return < > { type === NOTIFICATION_TYPE . ERROR && getErrorNotification ( intl ) } < />; } ) ;