This commit is contained in:
Manav Rathi 2024-05-26 18:58:57 +05:30
parent ca00b3b558
commit 3a5311cdcc
No known key found for this signature in database

View file

@ -13,7 +13,7 @@ import {
convertBase64ToBuffer,
convertBufferToBase64,
} from "@ente/accounts/utils";
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 FormPaper from "@ente/shared/components/Form/FormPaper";
@ -35,7 +35,11 @@ import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
export default function ChangePassword({ appName }: PageProps) {
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName } = appContext;
const appNameOld = appNameToAppNameOld(appName);
const [token, setToken] = useState<string>();
const [user, setUser] = useState<User>();
@ -123,7 +127,7 @@ export default function ChangePassword({ appName }: PageProps) {
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(appName) ?? "/");
router.push(APP_HOMES.get(appNameOld) ?? "/");
};
// TODO: Handle the case where user is not loaded yet.
@ -146,4 +150,6 @@ export default function ChangePassword({ appName }: PageProps) {
</FormPaper>
</VerticallyCentered>
);
}
};
export default Page;