fix(ForgotPasswordPage): handle loading state correctly during password reset

This commit is contained in:
Zeke Zhang 2025-04-18 09:34:20 +08:00
parent 728b28632b
commit e79f111cf9

View File

@ -46,9 +46,12 @@ const getForgotPasswordForm = (): ISchema => ({
async run() { async run() {
await form.submit(); await form.submit();
setLoading(true); setLoading(true);
await api.auth.lostPassword(form.values); try {
await api.auth.lostPassword(form.values);
} finally {
setLoading(false);
}
message.success(t("Reset email sent successfully")); message.success(t("Reset email sent successfully"));
setLoading(false);
form.reset(); form.reset();
}, },
loading, loading,