Reset error messages between login screens; ref #2455
This commit is contained in:
parent
527ba1adc4
commit
cbbe5b6fa9
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import requestPasswordResetEmail from '@/api/auth/requestPasswordResetEmail';
|
import requestPasswordResetEmail from '@/api/auth/requestPasswordResetEmail';
|
||||||
import { httpErrorToHuman } from '@/api/http';
|
import { httpErrorToHuman } from '@/api/http';
|
||||||
|
@ -24,6 +24,10 @@ export default () => {
|
||||||
const { clearFlashes, addFlash } = useFlash();
|
const { clearFlashes, addFlash } = useFlash();
|
||||||
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
|
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
clearFlashes();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleSubmission = ({ email }: Values, { setSubmitting, resetForm }: FormikHelpers<Values>) => {
|
const handleSubmission = ({ email }: Values, { setSubmitting, resetForm }: FormikHelpers<Values>) => {
|
||||||
clearFlashes();
|
clearFlashes();
|
||||||
|
|
||||||
|
|
|
@ -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 { Link, RouteComponentProps } from 'react-router-dom';
|
||||||
import login from '@/api/auth/login';
|
import login from '@/api/auth/login';
|
||||||
import LoginFormContainer from '@/components/auth/LoginFormContainer';
|
import LoginFormContainer from '@/components/auth/LoginFormContainer';
|
||||||
|
@ -23,6 +23,10 @@ const LoginContainer = ({ history }: RouteComponentProps) => {
|
||||||
const { clearFlashes, clearAndAddHttpError } = useFlash();
|
const { clearFlashes, clearAndAddHttpError } = useFlash();
|
||||||
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
|
const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
clearFlashes();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const onSubmit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
const onSubmit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||||
clearFlashes();
|
clearFlashes();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue