chore: add loading

This commit is contained in:
Zeke Zhang 2025-04-20 16:58:46 +08:00
parent 3e8f0be43f
commit 3d7c52a53c
8 changed files with 22 additions and 8 deletions

View File

@ -50,15 +50,22 @@ const getResetPasswordForm = (): ISchema => ({
const api = useAPIClient(); const api = useAPIClient();
const { t } = useAuthTranslation(); const { t } = useAuthTranslation();
const resetToken = new URLSearchParams(window.location.search).get('resetToken'); const resetToken = new URLSearchParams(window.location.search).get('resetToken');
const [loading, setLoading] = React.useState(false);
return { return {
async run() { async run() {
await form.submit(); await form.submit();
await api.auth.resetPassword({ ...form.values, resetToken }); setLoading(true);
try {
await api.auth.resetPassword({ ...form.values, resetToken });
} finally {
setLoading(false);
}
message.success(t("Password reset successful")); message.success(t("Password reset successful"));
setTimeout(() => { setTimeout(() => {
window.location.href = '/signin'; window.location.href = '/signin';
}, 1000); }, 1000);
}, },
loading,
}; };
}, },
}, },

View File

@ -61,5 +61,6 @@
"Go to login": "Zur Anmeldung gehen", "Go to login": "Zur Anmeldung gehen",
"Please enter new password": "Bitte geben Sie ein neues Passwort ein", "Please enter new password": "Bitte geben Sie ein neues Passwort ein",
"Please enter the same password again": "Bitte geben Sie dasselbe Passwort erneut ein", "Please enter the same password again": "Bitte geben Sie dasselbe Passwort erneut ein",
"The passwords entered twice are inconsistent": "Die zweimal eingegebenen Passwörter stimmen nicht überein" "The passwords entered twice are inconsistent": "Die zweimal eingegebenen Passwörter stimmen nicht überein",
"Password reset successful": "Passwort zurücksetzen erfolgreich"
} }

View File

@ -61,5 +61,6 @@
"Go to login": "Go to login", "Go to login": "Go to login",
"Please enter new password": "Please enter new password", "Please enter new password": "Please enter new password",
"Please enter the same password again": "Please enter the same password again", "Please enter the same password again": "Please enter the same password again",
"The passwords entered twice are inconsistent": "The passwords entered twice are inconsistent" "The passwords entered twice are inconsistent": "The passwords entered twice are inconsistent",
"Password reset successful": "Password reset successful"
} }

View File

@ -66,5 +66,6 @@
"Go to login": "Vai al login", "Go to login": "Vai al login",
"Please enter new password": "Si prega di inserire una nuova password", "Please enter new password": "Si prega di inserire una nuova password",
"Please enter the same password again": "Si prega di reinserire la stessa password", "Please enter the same password again": "Si prega di reinserire la stessa password",
"The passwords entered twice are inconsistent": "Le password inserite due volte non corrispondono" "The passwords entered twice are inconsistent": "Le password inserite due volte non corrispondono",
"Password reset successful": "Reimpostazione password riuscita"
} }

View File

@ -38,5 +38,6 @@
"Go to login": "ログインに移動", "Go to login": "ログインに移動",
"Please enter new password": "新しいパスワードを入力してください。", "Please enter new password": "新しいパスワードを入力してください。",
"Please enter the same password again": "同じパスワードを再度入力してください。", "Please enter the same password again": "同じパスワードを再度入力してください。",
"The passwords entered twice are inconsistent": "2回入力されたパスワードが一致しません" "The passwords entered twice are inconsistent": "2回入力されたパスワードが一致しません",
"Password reset successful": "パスワードリセット成功"
} }

View File

@ -38,5 +38,6 @@
"Go to login": "로그인으로 가기", "Go to login": "로그인으로 가기",
"Please enter new password": "새 비밀번호를 입력하세요", "Please enter new password": "새 비밀번호를 입력하세요",
"Please enter the same password again": "같은 비밀번호를 다시 입력하세요", "Please enter the same password again": "같은 비밀번호를 다시 입력하세요",
"The passwords entered twice are inconsistent": "입력한 두 개의 비밀번호가 일치하지 않습니다" "The passwords entered twice are inconsistent": "입력한 두 개의 비밀번호가 일치하지 않습니다",
"Password reset successful": "비밀번호 재설정 성공"
} }

View File

@ -44,5 +44,6 @@
"Go to login": "Ga naar inloggen", "Go to login": "Ga naar inloggen",
"Please enter new password": "Voer een nieuw wachtwoord in", "Please enter new password": "Voer een nieuw wachtwoord in",
"Please enter the same password again": "Voer hetzelfde wachtwoord opnieuw in", "Please enter the same password again": "Voer hetzelfde wachtwoord opnieuw in",
"The passwords entered twice are inconsistent": "De twee ingevoerde wachtwoorden zijn inconsistent" "The passwords entered twice are inconsistent": "De twee ingevoerde wachtwoorden zijn inconsistent",
"Password reset successful": "Wachtwoord opnieuw instellen succesvol"
} }

View File

@ -60,5 +60,6 @@
"Go to login": "前往登录", "Go to login": "前往登录",
"Please enter new password": "请输入新密码", "Please enter new password": "请输入新密码",
"Please enter the same password again": "请再次输入相同的密码", "Please enter the same password again": "请再次输入相同的密码",
"The passwords entered twice are inconsistent": "两次输入的密码不一致" "The passwords entered twice are inconsistent": "两次输入的密码不一致",
"Password reset successful": "密码重置成功"
} }