Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Improvement: Use select organization hook

Daniel Hougaard9a724db6ab96
diff --git a/frontend/src/views/Login/components/MFAStep/MFAStep.tsx b/frontend/src/views/Login/components/MFAStep/MFAStep.tsx
index 8fdd831bd4..acef4c3b1a 100644
--- a/frontend/src/views/Login/components/MFAStep/MFAStep.tsx
+++ b/frontend/src/views/Login/components/MFAStep/MFAStep.tsx
@@ -12,7 +12,7 @@ import attemptLoginMfa from "@app/components/utilities/attemptLoginMfa";
import { Button } from "@app/components/v2";
import { useUpdateUserAuthMethods } from "@app/hooks/api";
import { useSendMfaToken } from "@app/hooks/api/auth";
-import { selectOrganization } from "@app/hooks/api/auth/queries";
+import { useSelectOrganization } from "@app/hooks/api/auth/queries";
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
import { fetchUserDetails } from "@app/hooks/api/users/queries";
import { AuthMethod } from "@app/hooks/api/users/types";
@@ -70,6 +70,7 @@ export const MFAStep = ({ email, password, providerAuthToken }: Props) => {
const sendMfaToken = useSendMfaToken();
const { mutateAsync: updateUserAuthMethodsMutateAsync } = useUpdateUserAuthMethods();
+ const { mutateAsync: selectOrganization } = useSelectOrganization();
const handleLoginMfa = async () => {
try {
@@ -116,11 +117,6 @@ export const MFAStep = ({ email, password, providerAuthToken }: Props) => {
if (organizationId) {
const { token: newJwtToken } = await selectOrganization({ organizationId });
- console.log(
- "organization id was present. new JWT token to be used in CLI:",
- newJwtToken
- );
-
const instance = axios.create();
await instance.post(cliUrl, {
...isCliLoginSuccessful.loginResponse,
diff --git a/frontend/src/views/Login/components/PasswordStep/PasswordStep.tsx b/frontend/src/views/Login/components/PasswordStep/PasswordStep.tsx
index 7c819a1fdd..57250af518 100644
--- a/frontend/src/views/Login/components/PasswordStep/PasswordStep.tsx
+++ b/frontend/src/views/Login/components/PasswordStep/PasswordStep.tsx
@@ -10,7 +10,7 @@ import attemptCliLogin from "@app/components/utilities/attemptCliLogin";
import attemptLogin from "@app/components/utilities/attemptLogin";
import { Button, Input } from "@app/components/v2";
import { useUpdateUserAuthMethods } from "@app/hooks/api";
-import { selectOrganization } from "@app/hooks/api/auth/queries";
+import { useSelectOrganization } from "@app/hooks/api/auth/queries";
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
import { fetchUserDetails } from "@app/hooks/api/users/queries";
@@ -36,6 +36,7 @@ export const PasswordStep = ({
const { t } = useTranslation();
const router = useRouter();
const { mutateAsync } = useUpdateUserAuthMethods();
+ const { mutateAsync: selectOrganization } = useSelectOrganization();
const { callbackPort, isLinkingRequired, authMethod, organizationId } = jwt_decode(
providerAuthToken