Skip to content

armgit / ente

Public Imported from GitHub
0

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

Conv

Manav Rathi290ae4029632
diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.ts
index 96423f4bee..0138ca359c 100644
--- a/web/packages/accounts/services/user.ts
+++ b/web/packages/accounts/services/user.ts
@@ -294,16 +294,17 @@ export const changeEmail = async (email: string, ott: string) => {
);
};
+/**
+ * Start the two factor setup process by fetching a secret code (and the
+ * corresponding QR code) from remote.
+ */
export const setupTwoFactor = async () => {
- const resp = await HTTPService.post(
- await apiURL("/users/two-factor/setup"),
- null,
- undefined,
- {
- "X-Auth-Token": getToken(),
- },
- );
- return resp.data as TwoFactorSecret;
+ const res = await fetch(await apiURL("/users/two-factor/setup"), {
+ method: "POST",
+ headers: await authenticatedRequestHeaders(),
+ });
+ ensureOk(res);
+ return TwoFactorSecret.parse(await res.json());
};
export const enableTwoFactor = async (