Don't keep the spinners spinning

(this handles other types of cancel too)
This commit is contained in:
Manav Rathi
2025-06-06 13:40:42 +05:30
parent 0165f07bb9
commit 5b1b52e529

View File

@@ -72,10 +72,12 @@ const DeleteAccountDialogContents: React.FC<
},
onSubmit: async ({ reason, feedback }) => {
feedback = feedback.trim();
setLoading(true);
try {
setLoading(true);
const { allowDelete, encryptedChallenge } =
await getAccountDeleteChallenge();
setLoading(false);
if (allowDelete && encryptedChallenge) {
await onAuthenticateUser()
.then(confirmAccountDeletion)
@@ -91,8 +93,8 @@ const DeleteAccountDialogContents: React.FC<
}
} catch (e) {
onGenericError(e);
setLoading(false);
}
setLoading(false);
},
});
@@ -106,7 +108,6 @@ const DeleteAccountDialogContents: React.FC<
color: "critical",
action: resolve,
},
cancel: { text: t("cancel"), action: () => setLoading(false) },
}),
);
@@ -135,6 +136,7 @@ const DeleteAccountDialogContents: React.FC<
reason: string,
feedback: string,
) => {
setLoading(true);
const decryptedChallenge =
await decryptDeleteAccountChallenge(encryptedChallenge);
await deleteAccount(decryptedChallenge, reason, feedback);