diff --git a/src/Components/TabPanels/Account/TeamPanel.jsx b/src/Components/TabPanels/Account/TeamPanel.jsx index eef7b6421..950f0ea69 100644 --- a/src/Components/TabPanels/Account/TeamPanel.jsx +++ b/src/Components/TabPanels/Account/TeamPanel.jsx @@ -10,6 +10,7 @@ import { useSelector } from "react-redux"; import Select from "../../Inputs/Select"; import { GenericDialog } from "../../Dialog/genericDialog"; import DataTable from "../../Table/"; +import { useGetInviteToken } from "../../../Hooks/inviteHooks"; /** * TeamPanel component manages the organization and team members, * providing functionalities like renaming the organization, managing team members, @@ -20,7 +21,6 @@ import DataTable from "../../Table/"; const TeamPanel = () => { const theme = useTheme(); - const SPACING_GAP = theme.spacing(12); const [toInvite, setToInvite] = useState({ @@ -34,6 +34,8 @@ const TeamPanel = () => { const [errors, setErrors] = useState({}); const [isSendingInvite, setIsSendingInvite] = useState(false); + const [getInviteToken, clearToken, isLoading, error, token] = useGetInviteToken(); + const headers = [ { id: "name", @@ -124,6 +126,10 @@ const TeamPanel = () => { }); }; + const handleGetToken = async () => { + await getInviteToken({ email: toInvite.email, role: toInvite.role }); + }; + const handleInviteMember = async () => { if (!toInvite.email) { setErrors((prev) => ({ ...prev, email: "Email is required." })); @@ -146,7 +152,7 @@ const TeamPanel = () => { } try { - await networkService.requestInvitationToken({ + await networkService.sendInvitationToken({ email: toInvite.email, role: toInvite.role, }); @@ -165,6 +171,7 @@ const TeamPanel = () => { const closeInviteModal = () => { setIsOpen(false); + clearToken(); setToInvite({ email: "", role: ["0"] }); setErrors({}); }; @@ -275,6 +282,13 @@ const TeamPanel = () => { { _id: "user", name: "User" }, ]} /> + {token && Invite link} + {token && ( + + )} { > Cancel +