From beedd57ee1130dac2f6988ad6207b931bd5b4723 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Sat, 8 Apr 2023 13:46:21 +0530 Subject: [PATCH] fix: fetch selected project members (#741) * fix: fetch selected project members * chore: remove old imports --- .../integration/github/import-users.tsx | 1 + .../integration/github/single-user-select.tsx | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/app/components/integration/github/import-users.tsx b/apps/app/components/integration/github/import-users.tsx index e2bd0e153f4..db6b255a0ea 100644 --- a/apps/app/components/integration/github/import-users.tsx +++ b/apps/app/components/integration/github/import-users.tsx @@ -44,6 +44,7 @@ export const GithubImportUsers: FC = ({ handleStepChange, users, setUsers index={index} users={users} setUsers={setUsers} + project={watch("project")} /> ))} diff --git a/apps/app/components/integration/github/single-user-select.tsx b/apps/app/components/integration/github/single-user-select.tsx index e8204deb068..e478d119be1 100644 --- a/apps/app/components/integration/github/single-user-select.tsx +++ b/apps/app/components/integration/github/single-user-select.tsx @@ -4,20 +4,21 @@ import { useRouter } from "next/router"; import useSWR from "swr"; // services -import workspaceService from "services/workspace.service"; +import projectService from "services/project.service"; // ui import { Avatar, CustomSearchSelect, CustomSelect, Input } from "components/ui"; // types import { IGithubRepoCollaborator } from "types"; import { IUserDetails } from "./root"; // fetch-keys -import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; +import { PROJECT_MEMBERS } from "constants/fetch-keys"; type Props = { collaborator: IGithubRepoCollaborator; index: number; users: IUserDetails[]; setUsers: React.Dispatch>; + project: string | null; }; const importOptions = [ @@ -35,13 +36,21 @@ const importOptions = [ }, ]; -export const SingleUserSelect: React.FC = ({ collaborator, index, users, setUsers }) => { +export const SingleUserSelect: React.FC = ({ + collaborator, + index, + users, + setUsers, + project, +}) => { const router = useRouter(); const { workspaceSlug } = router.query; const { data: members } = useSWR( - workspaceSlug ? WORKSPACE_MEMBERS(workspaceSlug as string) : null, - workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug as string) : null + workspaceSlug && project ? PROJECT_MEMBERS(project) : null, + workspaceSlug && project + ? () => projectService.projectMembers(workspaceSlug as string, project) + : null ); const options =