import useTranslation from 'next-translate/useTranslation' import { FormState as FormStateType } from 'hooks/useFormState' import { ErrorMessage } from './ErrorMessage' import { Loader } from 'components/design/Loader' export interface FormStateProps { state: FormStateType message?: string } export const FormState: React.FC = (props) => { const { state, message } = props const { t } = useTranslation() if (state === 'loading') { return ( <>
) } if (state === 'idle' || message == null) { return null } if (state === 'success') { return ( <>
{t('authentication:success')} : {message}
) } return ( <>
) }