This commit is contained in:
Manav Rathi 2024-05-26 19:10:50 +05:30
parent 345c706814
commit 27127ff3d4
No known key found for this signature in database
2 changed files with 13 additions and 10 deletions

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 } 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 LinkButton from "@ente/shared/components/LinkButton";
@ -23,7 +23,11 @@ export enum SetupMode {
MANUAL_CODE,
}
export default function SetupTwoFactor({ appName }: PageProps) {
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName } = appContext;
const appNameOld = appNameToAppNameOld(appName);
const [twoFactorSecret, setTwoFactorSecret] = useState<
TwoFactorSecret | undefined
>();
@ -59,7 +63,7 @@ export default function SetupTwoFactor({ appName }: PageProps) {
isTwoFactorEnabled: true,
});
// TODO: Refactor the type of APP_HOMES to not require the ??
router.push(APP_HOMES.get(appName) ?? "/");
router.push(APP_HOMES.get(appNameOld) ?? "/");
};
return (
@ -85,4 +89,6 @@ export default function SetupTwoFactor({ appName }: PageProps) {
</Card>
</VerticallyCentered>
);
}
};
export default Page;

View file

@ -1,10 +1,9 @@
import { ensure } from "@/utils/ensure";
import { verifyTwoFactor } from "@ente/accounts/api/user";
import VerifyTwoFactor, {
type VerifyTwoFactorCallback,
} from "@ente/accounts/components/two-factor/VerifyForm";
import { PAGES } from "@ente/accounts/constants/pages";
import { ensure } from "@/utils/ensure";
import type { PageProps } from "@ente/shared/apps/types";
import { VerticallyCentered } from "@ente/shared/components/Container";
import FormPaper from "@ente/shared/components/Form/FormPaper";
@ -20,9 +19,7 @@ import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
export const TwoFactorVerify: React.FC<PageProps> = ({
appContext,
}: PageProps) => {
const Page: React.FC<PageProps> = ({ appContext }) => {
const { logout } = appContext;
const [sessionID, setSessionID] = useState("");
@ -93,4 +90,4 @@ export const TwoFactorVerify: React.FC<PageProps> = ({
);
};
export default TwoFactorVerify;
export default Page;