mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 13:28:27 +00:00
Multi user org invites
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import { useAddUserToOrg } from "@app/hooks/api";
|
import { useAddUsersToOrg } from "@app/hooks/api";
|
||||||
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
|
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
|
||||||
import { usePopUp } from "@app/hooks/usePopUp";
|
import { usePopUp } from "@app/hooks/usePopUp";
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ export default function TeamInviteStep(): JSX.Element {
|
|||||||
const [emails, setEmails] = useState("");
|
const [emails, setEmails] = useState("");
|
||||||
const { data: serverDetails } = useFetchServerStatus();
|
const { data: serverDetails } = useFetchServerStatus();
|
||||||
|
|
||||||
const { mutateAsync } = useAddUserToOrg();
|
const { mutateAsync } = useAddUsersToOrg();
|
||||||
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["setUpEmail"] as const);
|
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["setUpEmail"] as const);
|
||||||
|
|
||||||
// Redirect user to the getting started page
|
// Redirect user to the getting started page
|
||||||
@@ -31,7 +31,7 @@ export default function TeamInviteStep(): JSX.Element {
|
|||||||
.map((email) => email.trim())
|
.map((email) => email.trim())
|
||||||
.map(async (email) => {
|
.map(async (email) => {
|
||||||
mutateAsync({
|
mutateAsync({
|
||||||
inviteeEmail: email,
|
inviteeEmails: [email],
|
||||||
organizationId: String(localStorage.getItem("orgData.id"))
|
organizationId: String(localStorage.getItem("orgData.id"))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export {
|
|||||||
} from "./mutation";
|
} from "./mutation";
|
||||||
export {
|
export {
|
||||||
fetchOrgUsers,
|
fetchOrgUsers,
|
||||||
useAddUserToOrg,
|
useAddUsersToOrg,
|
||||||
useCreateAPIKey,
|
useCreateAPIKey,
|
||||||
useDeleteAPIKey,
|
useDeleteAPIKey,
|
||||||
useDeleteMe,
|
useDeleteMe,
|
||||||
@@ -26,4 +26,5 @@ export {
|
|||||||
useRevokeMySessions,
|
useRevokeMySessions,
|
||||||
useUpdateMfaEnabled,
|
useUpdateMfaEnabled,
|
||||||
useUpdateOrgMembership,
|
useUpdateOrgMembership,
|
||||||
useUpdateUserAuthMethods} from "./queries";
|
useUpdateUserAuthMethods
|
||||||
|
} from "./queries";
|
||||||
|
|||||||
@@ -157,12 +157,15 @@ export const useGetOrgUsers = (orgId: string) =>
|
|||||||
|
|
||||||
// mutation
|
// mutation
|
||||||
// TODO(akhilmhdh): move all mutation to mutation file
|
// TODO(akhilmhdh): move all mutation to mutation file
|
||||||
export const useAddUserToOrg = () => {
|
export const useAddUsersToOrg = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
type Response = {
|
type Response = {
|
||||||
data: {
|
data: {
|
||||||
message: string;
|
message: string;
|
||||||
completeInviteLink: string | undefined;
|
completeInviteLinks: {
|
||||||
|
email: string;
|
||||||
|
link: string;
|
||||||
|
}[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user