diff --git a/app/scenes/Settings/Preferences.tsx b/app/scenes/Settings/Preferences.tsx
index da1f3850f..01d3e81b3 100644
--- a/app/scenes/Settings/Preferences.tsx
+++ b/app/scenes/Settings/Preferences.tsx
@@ -42,7 +42,7 @@ function Preferences() {
const showDeleteAccount = () => {
dialogs.openModal({
title: t("Delete account"),
- content: ,
+ content: ,
isCentered: true,
});
};
diff --git a/app/scenes/TeamDelete.tsx b/app/scenes/TeamDelete.tsx
index 68c73156e..acc4eeb7b 100644
--- a/app/scenes/TeamDelete.tsx
+++ b/app/scenes/TeamDelete.tsx
@@ -58,7 +58,7 @@ function TeamDelete({ onSubmit }: Props) {
);
const inputProps = register("code", {
- required: true,
+ required: env.EMAIL_ENABLED,
});
const appName = env.APP_NAME;
const workspaceName = team.name;
diff --git a/app/scenes/UserDelete.tsx b/app/scenes/UserDelete.tsx
index 234448e42..8a60dfaa4 100644
--- a/app/scenes/UserDelete.tsx
+++ b/app/scenes/UserDelete.tsx
@@ -14,7 +14,12 @@ type FormData = {
code: string;
};
-function UserDelete() {
+type Props = {
+ /** Callback to close the dialog when user deletion completes. */
+ onSubmit: () => void;
+};
+
+function UserDelete({ onSubmit }: Props) {
const [isWaitingCode, setWaitingCode] = React.useState(false);
const { auth } = useStores();
const { t } = useTranslation();
@@ -31,11 +36,12 @@ function UserDelete() {
try {
await auth.requestDeleteUser();
setWaitingCode(true);
+ onSubmit();
} catch (err) {
toast.error(err.message);
}
},
- [auth]
+ [auth, onSubmit]
);
const handleSubmit = React.useCallback(
@@ -51,7 +57,7 @@ function UserDelete() {
);
const inputProps = register("code", {
- required: true,
+ required: env.EMAIL_ENABLED,
});
const appName = env.APP_NAME;