fix: import user using endpoint with email (#1819)

This commit is contained in:
Dakshesh Jain 2023-08-09 17:49:25 +05:30 committed by GitHub
parent c9d0c5353d
commit be062ccd34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,11 +3,17 @@ import { FC } from "react";
// next // next
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// swr
import useSWR from "swr";
// react-hook-form // react-hook-form
import { useFormContext, useFieldArray, Controller } from "react-hook-form"; import { useFormContext, useFieldArray, Controller } from "react-hook-form";
// hooks // fetch keys
import useWorkspaceMembers from "hooks/use-workspace-members"; import { WORKSPACE_MEMBERS_WITH_EMAIL } from "constants/fetch-keys";
// services
import workspaceService from "services/workspace.service";
// components // components
import { ToggleSwitch, Input, CustomSelect, CustomSearchSelect, Avatar } from "components/ui"; import { ToggleSwitch, Input, CustomSelect, CustomSearchSelect, Avatar } from "components/ui";
@ -30,7 +36,12 @@ export const JiraImportUsers: FC = () => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug } = router.query; 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) => ({ const options = members?.map((member) => ({
value: member.member.email, value: member.member.email,