mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Improvement: Use select organization hook
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user