Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Conv

Manav Rathi7725b1493554
diff --git a/web/packages/accounts/pages/two-factor/setup.tsx b/web/packages/accounts/pages/two-factor/setup.tsx
index d41aaa0a6f..718a6c561f 100644
--- a/web/packages/accounts/pages/two-factor/setup.tsx
+++ b/web/packages/accounts/pages/two-factor/setup.tsx
@@ -4,7 +4,6 @@ import { enableTwoFactor, setupTwoFactor } from "@/accounts/services/user";
import { CenteredFill } from "@/base/components/containers";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
-import log from "@/base/log";
import {
CenteredFlex,
VerticallyCentered,
@@ -29,18 +28,8 @@ const Page: React.FC = () => {
const router = useRouter();
useEffect(() => {
- if (twoFactorSecret) {
- return;
- }
- const main = async () => {
- try {
- const twoFactorSecret = await setupTwoFactor();
- setTwoFactorSecret(twoFactorSecret);
- } catch (e) {
- log.error("failed to get two factor setup code", e);
- }
- };
- void main();
+ if (twoFactorSecret) return; // HMR
+ void setupTwoFactor().then(setTwoFactorSecret);
}, []);
const onSubmit: VerifyTwoFactorCallback = async (