diff --git a/frontend/src/components/organisms/CreateEventForm.tsx b/frontend/src/components/organisms/CreateEventForm.tsx index f51e667b..3c80c0f1 100644 --- a/frontend/src/components/organisms/CreateEventForm.tsx +++ b/frontend/src/components/organisms/CreateEventForm.tsx @@ -86,7 +86,7 @@ const CreateEventForm: FC = ({ address }) => { }, }); - const { remove, append } = useFieldArray({ control, name: "nfts" }); + const { fields, remove, append } = useFieldArray({ control, name: "nfts" }); const { gasFee } = useCalcMtxGasFee(watch("mintLimit")); @@ -477,6 +477,7 @@ const CreateEventForm: FC = ({ address }) => { diff --git a/frontend/src/components/organisms/NFTAttributesForm.tsx b/frontend/src/components/organisms/NFTAttributesForm.tsx index 1aefeca3..0cf32aa7 100644 --- a/frontend/src/components/organisms/NFTAttributesForm.tsx +++ b/frontend/src/components/organisms/NFTAttributesForm.tsx @@ -14,7 +14,7 @@ import { Text, } from "@chakra-ui/react"; import { FC } from "react"; -import { Controller, Control, UseFieldArrayRemove } from "react-hook-form"; +import { Controller, Control, FieldArray, UseFieldArrayRemove } from "react-hook-form"; import { useLocale } from "../../hooks/useLocale"; import ErrorMessage from "../atoms/form/ErrorMessage"; import ImageSelectorWithPreview from "../ImageSelectorWithPreview"; @@ -24,11 +24,12 @@ import ordinal from "ordinal"; type Props = { control: Control; nfts: NFT.NFTImage[]; + fields: FieldArray; append: (v: any) => void; remove: UseFieldArrayRemove; }; -const NFTAttributesForm: FC = ({ control, nfts, append, remove }) => { +const NFTAttributesForm: FC = ({ control, nfts, fields, append, remove }) => { const { t, locale } = useLocale(); const validateUniqRequiredParticipateCount = (v: number) => { @@ -56,9 +57,9 @@ const NFTAttributesForm: FC = ({ control, nfts, append, remove }) => { return ( - {nfts.map((nft, index) => ( + {fields.map((nft: NFT.NFTImage, index: number) => ( = ({ control, nfts, append, remove }) => { borderRadius="full" aria-label="" icon={} - onClick={() => remove(index)} + onClick={() => { + console.log(index) + remove(index) + }} /> )}