Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Promise

Manav Rathi833b564acc2c
diff --git a/web/packages/new/photos/components/DeleteAccount.tsx b/web/packages/new/photos/components/DeleteAccount.tsx
index d3ff921b9c..e8a4d2c180 100644
--- a/web/packages/new/photos/components/DeleteAccount.tsx
+++ b/web/packages/new/photos/components/DeleteAccount.tsx
@@ -62,42 +62,43 @@ export const DeleteAccount: React.FC<DeleteAccountProps> = ({
return {};
},
onSubmit: async ({ reason, feedback }) => {
+ feedback = feedback.trim();
+ setLoading(true);
try {
- feedback = feedback.trim();
- setLoading(true);
const { allowDelete, encryptedChallenge } =
await getAccountDeleteChallenge();
if (allowDelete && encryptedChallenge) {
- onAuthenticateUser().then(() =>
- confirmAccountDeletion(() =>
+ await onAuthenticateUser()
+ .then(confirmAccountDeletion)
+ .then(() =>
solveChallengeAndDeleteAccount(
encryptedChallenge,
reason,
feedback,
),
- ),
- );
+ );
} else {
askToMailForDeletion();
}
} catch (e) {
onGenericError(e);
- } finally {
- setLoading(false);
}
+ setLoading(false);
},
});
- const confirmAccountDeletion = (onConfirm: () => void) =>
- showMiniDialog({
- title: t("delete_account"),
- message: <Trans i18nKey="delete_account_confirm_message" />,
- continue: {
- text: t("delete"),
- color: "critical",
- action: onConfirm,
- },
- });
+ const confirmAccountDeletion = () =>
+ new Promise<void>((resolve) =>
+ showMiniDialog({
+ title: t("delete_account"),
+ message: <Trans i18nKey="delete_account_confirm_message" />,
+ continue: {
+ text: t("delete"),
+ color: "critical",
+ action: resolve,
+ },
+ }),
+ );
const askToMailForDeletion = () => {
const emailID = "[email protected]";