diff --git a/apps/app/components/project/send-project-invitation-modal.tsx b/apps/app/components/project/send-project-invitation-modal.tsx index d37ad627f68..414ef7a6c14 100644 --- a/apps/app/components/project/send-project-invitation-modal.tsx +++ b/apps/app/components/project/send-project-invitation-modal.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { useRouter } from "next/router"; -import useSWR, { mutate } from "swr"; +import useSWR from "swr"; import { useForm, Controller, useFieldArray } from "react-hook-form"; @@ -28,7 +28,7 @@ import useToast from "hooks/use-toast"; // types import { ICurrentUserResponse } from "types"; // fetch-keys -import { PROJECT_MEMBERS, WORKSPACE_MEMBERS } from "constants/fetch-keys"; +import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; // constants import { ROLE } from "constants/workspace"; @@ -37,6 +37,7 @@ type Props = { setIsOpen: React.Dispatch>; members: any[]; user: ICurrentUserResponse | undefined; + onSuccess: () => void; }; type member = { @@ -57,7 +58,9 @@ const defaultValues: FormValues = { ], }; -const SendProjectInvitationModal: React.FC = ({ isOpen, setIsOpen, members, user }) => { +const SendProjectInvitationModal: React.FC = (props) => { + const { isOpen, setIsOpen, members, user, onSuccess } = props; + const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -98,13 +101,13 @@ const SendProjectInvitationModal: React.FC = ({ isOpen, setIsOpen, member type: "success", message: "Member added successfully", }); + onSuccess(); }) .catch((error) => { console.log(error); }) .finally(() => { reset(defaultValues); - mutate(PROJECT_MEMBERS(projectId.toString())); }); }; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx index 6fb29efb21f..ec8c0c43b3e 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx @@ -108,6 +108,8 @@ const MembersSettings: NextPage = () => { const currentUser = projectMembers?.find((item) => item.member.id === user?.id); + const handleProjectInvitationSuccess = () => {}; + return ( { setIsOpen={setInviteModal} members={members} user={user} + onSuccess={() => mutateMembers()} />