mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
Show loading state while submitting password reset form (#2487)
This commit is contained in:
parent
498ddcd836
commit
18ef3273d3
1 changed files with 13 additions and 1 deletions
|
|
@ -31,6 +31,9 @@ class ResetPassword extends React.Component {
|
|||
password_confirmation: '',
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
isLoading: true,
|
||||
});
|
||||
fetch(`${config.apiUrl}/reset_password`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
@ -41,13 +44,22 @@ class ResetPassword extends React.Component {
|
|||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.error) {
|
||||
// update loading state here since user will still be on the page
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
});
|
||||
toast.error(res.message);
|
||||
} else {
|
||||
toast.success(res.message);
|
||||
this.props.history.push('/login');
|
||||
}
|
||||
})
|
||||
.catch(console.log);
|
||||
.catch((err) => {
|
||||
this.setState({
|
||||
isLoading: false,
|
||||
});
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
render() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue