diff --git a/web/packages/accounts/components/ChangeEmail.tsx b/web/packages/accounts/components/ChangeEmail.tsx index 6c76d644a64458509a170806d485434ed07c5ded..bb29893bf9a90622493ea86739c0da711f18ab25 100644 --- a/web/packages/accounts/components/ChangeEmail.tsx +++ b/web/packages/accounts/components/ChangeEmail.tsx @@ -68,7 +68,8 @@ function ChangeEmailForm({ appName }: PageProps) { }; const goToApp = () => { - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); }; return ( diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsx index 1696c5b9ff2d30a82ca52278956530783a298983..24617cb46d1547e0712ff80dac51b7f29f4f07a0 100644 --- a/web/packages/accounts/pages/change-password.tsx +++ b/web/packages/accounts/pages/change-password.tsx @@ -121,7 +121,8 @@ export default function ChangePassword({ appName }: PageProps) { const redirectToAppHome = () => { setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true }); - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); }; return ( diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx index 6ef39c7c7af589ee9dac64ebe49cadf3cf554124..5da52ac0231fc66e8b4e0e2022b92564cda74061 100644 --- a/web/packages/accounts/pages/credentials.tsx +++ b/web/packages/accounts/pages/credentials.tsx @@ -86,7 +86,8 @@ export default function Credentials({ appContext, appName }: PageProps) { } const token = getToken(); if (key && token) { - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); return; } const kekEncryptedAttributes: B64EncryptionResult = getKey( diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsx index e9ad433d5ba0cd64b075b1a9b71c67fe1002ac63..21c803bc6fa617ab2431a1950b739f10e85129a7 100644 --- a/web/packages/accounts/pages/generate.tsx +++ b/web/packages/accounts/pages/generate.tsx @@ -1,4 +1,5 @@ import log from "@/next/log"; +import { ensure } from "@/utils/ensure"; import { putAttributes } from "@ente/accounts/api/user"; import SetPasswordForm, { type SetPasswordFormProps, @@ -55,7 +56,8 @@ export default function Generate({ appContext, appName }: PageProps) { setRecoveryModalView(true); setLoading(false); } else { - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); } } else if (keyAttributes?.encryptedKey) { router.push(PAGES.CREDENTIALS); @@ -76,7 +78,8 @@ export default function Generate({ appContext, appName }: PageProps) { const { keyAttributes, masterKey, srpSetupAttributes } = await generateKeyAndSRPAttributes(passphrase); - await putAttributes(token, keyAttributes); + // TODO: Refactor the code to not require this ensure + await putAttributes(ensure(token), keyAttributes); await configureSRP(srpSetupAttributes); await generateAndSaveIntermediateKeyAttributes( passphrase, @@ -94,7 +97,7 @@ export default function Generate({ appContext, appName }: PageProps) { return ( <> - {loading ? ( + {loading || !user ? ( @@ -104,7 +107,8 @@ export default function Generate({ appContext, appName }: PageProps) { show={recoverModalView} onHide={() => { setRecoveryModalView(false); - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); }} /* TODO: Why is this error being ignored */ somethingWentWrong={() => {}} @@ -114,7 +118,7 @@ export default function Generate({ appContext, appName }: PageProps) { {t("SET_PASSPHRASE")} diff --git a/web/packages/accounts/pages/recover.tsx b/web/packages/accounts/pages/recover.tsx index 2173037d371e45bc1ca8fce6cf2c8766fffa05c9..09e00048755173906e3ff8f1a286c62c9fe19ffb 100644 --- a/web/packages/accounts/pages/recover.tsx +++ b/web/packages/accounts/pages/recover.tsx @@ -53,7 +53,8 @@ export default function Recover({ appContext, appName }: PageProps) { if (!keyAttributes) { router.push(PAGES.GENERATE); } else if (key) { - router.push(APP_HOMES.get(appName)); + // TODO: Refactor the type of APP_HOMES to not require the ?? + router.push(APP_HOMES.get(appName) ?? "/"); } else { setKeyAttributes(keyAttributes); }