|
|
|
@@ -20,6 +20,7 @@ import { |
|
|
|
FormHelperText, |
|
|
|
TextField, |
|
|
|
IconButton, InputAdornment, |
|
|
|
CircularProgress, |
|
|
|
|
|
|
|
} from '@mui/material'; |
|
|
|
import Loadable from 'components/Loadable'; |
|
|
|
@@ -48,7 +49,9 @@ const Index = () => { |
|
|
|
const [verifyState, setVerifyState] = React.useState(null) |
|
|
|
const [enterUseEffect, setEnterUseEffect] = React.useState(false) |
|
|
|
const [username, setUsername] = React.useState("") |
|
|
|
|
|
|
|
const [isSubmitting, setIsSubmitting] = React.useState(false) |
|
|
|
const submittingRef = React.useRef(false) |
|
|
|
|
|
|
|
|
|
|
|
const params = useParams() |
|
|
|
const intl = useIntl(); |
|
|
|
@@ -94,6 +97,9 @@ const Index = () => { |
|
|
|
} |
|
|
|
|
|
|
|
const goLogin = async (values) =>{ |
|
|
|
if (submittingRef.current) return; |
|
|
|
submittingRef.current = true; |
|
|
|
setIsSubmitting(true); |
|
|
|
dispatch(handleLogoutFunction()); |
|
|
|
HttpUtils.post({ |
|
|
|
url: UrlUtils.POST_FORGOT_PASSWORD_NEW_PASSWORD, |
|
|
|
@@ -110,19 +116,24 @@ const Index = () => { |
|
|
|
// console.log(response) |
|
|
|
navigate('/forgot/password/success'); |
|
|
|
location.reload() |
|
|
|
// setSumitting(false) |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
console.error(error) |
|
|
|
submittingRef.current = false; |
|
|
|
setIsSubmitting(false); |
|
|
|
}); |
|
|
|
}, |
|
|
|
onFail: (response)=>{ |
|
|
|
console.log("Fail"); |
|
|
|
console.log(response); |
|
|
|
submittingRef.current = false; |
|
|
|
setIsSubmitting(false); |
|
|
|
window.location.assign("/iamsmart/loginFail"); |
|
|
|
}, |
|
|
|
onError:(error)=>{ |
|
|
|
console.log(error); |
|
|
|
submittingRef.current = false; |
|
|
|
setIsSubmitting(false); |
|
|
|
window.location.assign("/iamsmart/loginFail"); |
|
|
|
} |
|
|
|
}); |
|
|
|
@@ -384,9 +395,10 @@ const Index = () => { |
|
|
|
aria-label={intl.formatMessage({id: 'confirm'})} |
|
|
|
variant="contained" |
|
|
|
type="submit" |
|
|
|
// onClick={()=>goLogin()} |
|
|
|
disabled={isSubmitting} |
|
|
|
startIcon={isSubmitting ? <CircularProgress color="inherit" size={20} /> : null} |
|
|
|
> |
|
|
|
<FormattedMessage id="confirm"/> |
|
|
|
{isSubmitting ? <FormattedMessage id="loading"/> : <FormattedMessage id="confirm"/>} |
|
|
|
</Button> |
|
|
|
</ThemeProvider> |
|
|
|
</Grid> |
|
|
|
|