From 17b49595a01d4e60731b0d5ea53b55cf0546249b Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sun, 26 May 2024 18:23:55 +0530 Subject: [PATCH] generate --- web/packages/accounts/pages/generate.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsx index 21c803bc6..e367813e7 100644 --- a/web/packages/accounts/pages/generate.tsx +++ b/web/packages/accounts/pages/generate.tsx @@ -7,7 +7,7 @@ import SetPasswordForm, { import { PAGES } from "@ente/accounts/constants/pages"; import { configureSRP } from "@ente/accounts/services/srp"; import { generateKeyAndSRPAttributes } from "@ente/accounts/utils/srp"; -import { APP_HOMES } from "@ente/shared/apps/constants"; +import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants"; import type { PageProps } from "@ente/shared/apps/types"; import { VerticallyCentered } from "@ente/shared/components/Container"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; @@ -31,8 +31,10 @@ import { t } from "i18next"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; -export default function Generate({ appContext, appName }: PageProps) { - const { logout } = appContext; +const Page: React.FC = ({ appContext }) => { + const { appName, logout } = appContext; + + const appNameOld = appNameToAppNameOld(appName); const [token, setToken] = useState(); const [user, setUser] = useState(); @@ -57,7 +59,7 @@ export default function Generate({ appContext, appName }: PageProps) { setLoading(false); } else { // TODO: Refactor the type of APP_HOMES to not require the ?? - router.push(APP_HOMES.get(appName) ?? "/"); + router.push(APP_HOMES.get(appNameOld) ?? "/"); } } else if (keyAttributes?.encryptedKey) { router.push(PAGES.CREDENTIALS); @@ -108,7 +110,7 @@ export default function Generate({ appContext, appName }: PageProps) { onHide={() => { setRecoveryModalView(false); // TODO: Refactor the type of APP_HOMES to not require the ?? - router.push(APP_HOMES.get(appName) ?? "/"); + router.push(APP_HOMES.get(appNameOld) ?? "/"); }} /* TODO: Why is this error being ignored */ somethingWentWrong={() => {}} @@ -132,4 +134,6 @@ export default function Generate({ appContext, appName }: PageProps) { )} ); -} +}; + +export default Page;