rl3
This commit is contained in:
parent
0f45244457
commit
96cd6b3759
9 changed files with 29 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
import { CustomHead } from "@/next/components/Head";
|
||||
import { setupI18n } from "@/next/i18n";
|
||||
import { logUnhandledErrorsAndRejections } from "@/next/log-web";
|
||||
import { PAGES } from "@ente/accounts/constants/pages";
|
||||
import { accountLogout } from "@ente/accounts/services/logout";
|
||||
import { APPS, APP_TITLES } from "@ente/shared/apps/constants";
|
||||
import { Overlay } from "@ente/shared/components/Container";
|
||||
import DialogBoxV2 from "@ente/shared/components/DialogBoxV2";
|
||||
|
@ -27,6 +29,7 @@ interface AppContextProps {
|
|||
isMobile: boolean;
|
||||
showNavBar: (show: boolean) => void;
|
||||
setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
|
||||
logout: () => void;
|
||||
}
|
||||
|
||||
export const AppContext = createContext<AppContextProps>({} as AppContextProps);
|
||||
|
@ -78,6 +81,10 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||
|
||||
const theme = getTheme(themeColor, APPS.PHOTOS);
|
||||
|
||||
const logout = () => {
|
||||
void accountLogout().then(() => router.push(PAGES.ROOT));
|
||||
};
|
||||
|
||||
const title = isI18nReady
|
||||
? t("TITLE", { context: APPS.ACCOUNTS })
|
||||
: APP_TITLES.get(APPS.ACCOUNTS);
|
||||
|
@ -101,6 +108,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||
showNavBar,
|
||||
setDialogBoxAttributesV2:
|
||||
setDialogBoxAttributesV2 as any,
|
||||
logout,
|
||||
}}
|
||||
>
|
||||
{!isI18nReady && (
|
||||
|
|
|
@ -130,9 +130,8 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||
content: t("UNKNOWN_ERROR"),
|
||||
});
|
||||
|
||||
const logout = async () => {
|
||||
await accountLogout();
|
||||
router.push(PAGES.ROOT);
|
||||
const logout = () => {
|
||||
void accountLogout().then(() => router.push(PAGES.ROOT));
|
||||
};
|
||||
|
||||
const title = isI18nReady
|
||||
|
|
|
@ -338,9 +338,8 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||
content: t("UNKNOWN_ERROR"),
|
||||
});
|
||||
|
||||
const logout = async () => {
|
||||
await photosLogout();
|
||||
router.push(PAGES.ROOT);
|
||||
const logout = () => {
|
||||
void photosLogout().then(() => router.push(PAGES.ROOT));
|
||||
};
|
||||
|
||||
const title = isI18nReady
|
||||
|
|
|
@ -52,7 +52,9 @@ import {
|
|||
} from "../services/srp";
|
||||
import { SRPAttributes } from "../types/srp";
|
||||
|
||||
export default function Credentials({ appContext, appName, logout }: PageProps) {
|
||||
export default function Credentials({ appContext, appName }: PageProps) {
|
||||
const { logout } = appContext;
|
||||
|
||||
const [srpAttributes, setSrpAttributes] = useState<SRPAttributes>();
|
||||
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
|
||||
const [user, setUser] = useState<User>();
|
||||
|
|
|
@ -29,7 +29,9 @@ import {
|
|||
import { KeyAttributes, User } from "@ente/shared/user/types";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function Generate({ appContext, appName, logout }: PageProps) {
|
||||
export default function Generate({ appContext, appName }: PageProps) {
|
||||
const { logout } = appContext;
|
||||
|
||||
const [token, setToken] = useState<string>();
|
||||
const [user, setUser] = useState<User>();
|
||||
const [recoverModalView, setRecoveryModalView] = useState(false);
|
||||
|
|
|
@ -31,8 +31,9 @@ bip39.setDefaultWordlist("english");
|
|||
export default function Recover({
|
||||
appContext,
|
||||
twoFactorType = TwoFactorType.TOTP,
|
||||
logout,
|
||||
}: PageProps) {
|
||||
const { logout } = appContext;
|
||||
|
||||
const [encryptedTwoFactorSecret, setEncryptedTwoFactorSecret] =
|
||||
useState<B64EncryptionResult>(null);
|
||||
const [sessionID, setSessionID] = useState(null);
|
||||
|
|
|
@ -19,7 +19,11 @@ import { t } from "i18next";
|
|||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export const TwoFactorVerify: React.FC<PageProps> = ({ logout }: PageProps) => {
|
||||
export const TwoFactorVerify: React.FC<PageProps> = ({
|
||||
appContext,
|
||||
}: PageProps) => {
|
||||
const { logout } = appContext;
|
||||
|
||||
const [sessionID, setSessionID] = useState("");
|
||||
|
||||
const router = useRouter();
|
||||
|
|
|
@ -32,7 +32,9 @@ import { PAGES } from "../constants/pages";
|
|||
import { configureSRP } from "../services/srp";
|
||||
import { SRPSetupAttributes } from "../types/srp";
|
||||
|
||||
export default function VerifyPage({ appContext, appName, logout }: PageProps) {
|
||||
export default function VerifyPage({ appContext, appName }: PageProps) {
|
||||
const { logout } = appContext;
|
||||
|
||||
const [email, setEmail] = useState("");
|
||||
const [resend, setResend] = useState(0);
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ export interface PageProps {
|
|||
showNavBar: (show: boolean) => void;
|
||||
isMobile: boolean;
|
||||
setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
|
||||
logout: () => void;
|
||||
};
|
||||
appName: APPS;
|
||||
twoFactorType?: TwoFactorType;
|
||||
logout: () => void;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue