This commit is contained in:
Manav Rathi
2024-10-11 11:24:07 +05:30
parent 6c8bec0bad
commit be60bec4ae

View File

@@ -1,4 +1,6 @@
import { useIsMobileWidth } from "@/base/hooks";
import { useAppContext } from "@/new/photos/types/context";
import { errorDialogAttributes } from "@/base/components/utils/mini-dialog";
import { ensure } from "@/utils/ensure";
import CodeBlock from "@ente/shared/components/CodeBlock";
import DialogTitleWithCloseButton from "@ente/shared/components/DialogBox/TitleWithCloseButton";
@@ -29,9 +31,14 @@ interface Props {
}
function RecoveryKey({ somethingWentWrong, ...props }: Props) {
const { showMiniDialog } = useAppContext();
const [recoveryKey, setRecoveryKey] = useState<string | null>(null);
const fullScreen = useIsMobileWidth();
const somethingWentWrong1 = () =>
showMiniDialog(errorDialogAttributes(t("RECOVER_KEY_GENERATION_FAILED")))
useEffect(() => {
if (!props.show) {
return;
@@ -41,7 +48,7 @@ function RecoveryKey({ somethingWentWrong, ...props }: Props) {
const recoveryKey = await getRecoveryKey();
setRecoveryKey(bip39.entropyToMnemonic(recoveryKey));
} catch (e) {
somethingWentWrong();
somethingWentWrong1();
props.onHide();
}
};