From be062ccd34e1150e8aa714e112a299721cedfd4a Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:49:25 +0530 Subject: [PATCH] fix: import user using endpoint with email (#1819) --- .../integration/jira/import-users.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/app/components/integration/jira/import-users.tsx b/apps/app/components/integration/jira/import-users.tsx index 53620f047..bb3057f1e 100644 --- a/apps/app/components/integration/jira/import-users.tsx +++ b/apps/app/components/integration/jira/import-users.tsx @@ -3,11 +3,17 @@ import { FC } from "react"; // next import { useRouter } from "next/router"; +// swr +import useSWR from "swr"; + // react-hook-form import { useFormContext, useFieldArray, Controller } from "react-hook-form"; -// hooks -import useWorkspaceMembers from "hooks/use-workspace-members"; +// fetch keys +import { WORKSPACE_MEMBERS_WITH_EMAIL } from "constants/fetch-keys"; + +// services +import workspaceService from "services/workspace.service"; // components import { ToggleSwitch, Input, CustomSelect, CustomSearchSelect, Avatar } from "components/ui"; @@ -30,7 +36,12 @@ export const JiraImportUsers: FC = () => { const router = useRouter(); const { workspaceSlug } = router.query; - const { workspaceMembers: members } = useWorkspaceMembers(workspaceSlug?.toString() ?? ""); + const { data: members } = useSWR( + workspaceSlug ? WORKSPACE_MEMBERS_WITH_EMAIL(workspaceSlug?.toString() ?? "") : null, + workspaceSlug + ? () => workspaceService.workspaceMembersWithEmail(workspaceSlug?.toString() ?? "") + : null + ); const options = members?.map((member) => ({ value: member.member.email,