Reset error messages between login screens; ref #2455

This commit is contained in:
Dane Everitt 2020-10-17 14:45:33 -07:00
parent 527ba1adc4
commit cbbe5b6fa9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import * as React from 'react';
import { useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { Link } from 'react-router-dom';
import requestPasswordResetEmail from '@/api/auth/requestPasswordResetEmail';
import { httpErrorToHuman } from '@/api/http';
@ -24,6 +24,10 @@ export default () => {
const { clearFlashes, addFlash } = useFlash();
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
useEffect(() => {
clearFlashes();
}, []);
const handleSubmission = ({ email }: Values, { setSubmitting, resetForm }: FormikHelpers<Values>) => {
clearFlashes();

View file

@ -1,4 +1,4 @@
import React, { useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { Link, RouteComponentProps } from 'react-router-dom';
import login from '@/api/auth/login';
import LoginFormContainer from '@/components/auth/LoginFormContainer';
@ -23,6 +23,10 @@ const LoginContainer = ({ history }: RouteComponentProps) => {
const { clearFlashes, clearAndAddHttpError } = useFlash();
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
useEffect(() => {
clearFlashes();
}, []);
const onSubmit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
clearFlashes();