Преглед на файлове

avoid double click to forgot page

web_access_fix
Jason Chuang преди 2 дни
родител
ревизия
0ff322d87a
променени са 2 файла, в които са добавени 10 реда и са изтрити 2 реда
  1. +5
    -1
      src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js
  2. +5
    -1
      src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js

+ 5
- 1
src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js Целия файл

@@ -34,6 +34,7 @@ import {FormattedMessage, useIntl} from "react-intl";
const ForgotPasswordApplyForm = () => {
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
const [isSubmitting, setIsSubmitting] = React.useState(false);
const submittingRef = React.useRef(false);
// const [warningText, setWarningText] = React.useState("");s
// const [attachment, setAttachment] = React.useState({});
const intl = useIntl();
@@ -60,7 +61,8 @@ const ForgotPasswordApplyForm = () => {
username: yup.string().required(intl.formatMessage({id: 'requireUsername'})),
}),
onSubmit: values => {
if (isSubmitting) return;
if (submittingRef.current) return;
submittingRef.current = true;
// console.log(values)
setIsSubmitting(true);
HttpUtils.post({
@@ -70,12 +72,14 @@ const ForgotPasswordApplyForm = () => {
},
// files: [attachment],
onSuccess: function () {
submittingRef.current = false;
setIsSubmitting(false);
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!')
navigate('/forgot/password/sent');
// location.reload();
},
onError: function () {
submittingRef.current = false;
setIsSubmitting(false);
navigate('/forgot/password/sent');
}


+ 5
- 1
src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js Целия файл

@@ -34,6 +34,7 @@ import {FormattedMessage, useIntl} from "react-intl";
const ForgotUsernameApplyForm = () => {
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
const [isSubmitting, setIsSubmitting] = React.useState(false);
const submittingRef = React.useRef(false);
// const [warningText, setWarningText] = React.useState("");s
// const [attachment, setAttachment] = React.useState({});
const intl = useIntl();
@@ -62,7 +63,8 @@ const ForgotUsernameApplyForm = () => {
emailAddress: yup.string().email(intl.formatMessage({id: 'validEmailFormat'})).max(255).required(intl.formatMessage({id: 'requireEmail'})),
}),
onSubmit: values => {
if (isSubmitting) return;
if (submittingRef.current) return;
submittingRef.current = true;
// console.log(values)
setIsSubmitting(true);
HttpUtils.post({
@@ -72,12 +74,14 @@ const ForgotUsernameApplyForm = () => {
},
// files: [attachment],
onSuccess: function () {
submittingRef.current = false;
setIsSubmitting(false);
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!')
navigate('/forgot/username/sent');
// location.reload();
},
onError: function () {
submittingRef.current = false;
setIsSubmitting(false);
navigate('/forgot/username/sent');
}


Зареждане…
Отказ
Запис