This commit is contained in:
Manav Rathi
2024-06-05 13:58:17 +05:30
parent a65ebacfbd
commit 0f5f488fc7
3 changed files with 10 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ import {
convertBase64ToBuffer,
convertBufferToBase64,
} from "@ente/accounts/utils";
import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants";
import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import FormPaper from "@ente/shared/components/Form/FormPaper";
import FormPaperFooter from "@ente/shared/components/Form/FormPaper/Footer";
@@ -33,6 +33,7 @@ import type { KEK, KeyAttributes, User } from "@ente/shared/user/types";
import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { appHomeRoute } from "../services/redirect";
import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
@@ -126,8 +127,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
const redirectToAppHome = () => {
setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true });
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appNameOld) ?? "/");
router.push(appHomeRoute(appName));
};
// TODO: Handle the case where user is not loaded yet.

View File

@@ -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, appNameToAppNameOld } from "@ente/shared/apps/constants";
import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import FormPaper from "@ente/shared/components/Form/FormPaper";
@@ -29,6 +29,7 @@ import type { KeyAttributes, User } from "@ente/shared/user/types";
import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { appHomeRoute } from "../services/redirect";
import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
@@ -58,8 +59,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
setRecoveryModalView(true);
setLoading(false);
} else {
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appNameOld) ?? "/");
router.push(appHomeRoute(appName));
}
} else if (keyAttributes?.encryptedKey) {
router.push(PAGES.CREDENTIALS);
@@ -109,8 +109,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
show={recoverModalView}
onHide={() => {
setRecoveryModalView(false);
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appNameOld) ?? "/");
router.push(appHomeRoute(appName));
}}
/* TODO: Why is this error being ignored */
somethingWentWrong={() => {}}

View File

@@ -6,7 +6,7 @@ import VerifyTwoFactor, {
} from "@ente/accounts/components/two-factor/VerifyForm";
import { TwoFactorSetup } from "@ente/accounts/components/two-factor/setup";
import type { TwoFactorSecret } from "@ente/accounts/types/user";
import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants";
import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import { VerticallyCentered } from "@ente/shared/components/Container";
import LinkButton from "@ente/shared/components/LinkButton";
import { encryptWithRecoveryKey } from "@ente/shared/crypto/helpers";
@@ -16,6 +16,7 @@ import Card from "@mui/material/Card";
import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { appHomeRoute } from "../../services/redirect";
import type { PageProps } from "../../types/page";
export enum SetupMode {
@@ -62,8 +63,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
...getData(LS_KEYS.USER),
isTwoFactorEnabled: true,
});
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appNameOld) ?? "/");
router.push(appHomeRoute(appName));
};
return (