diff --git a/src/components/form/form.tsx b/src/components/form/form.tsx index aac4016..dcee97e 100644 --- a/src/components/form/form.tsx +++ b/src/components/form/form.tsx @@ -4,7 +4,7 @@ import React from "react"; import { Form, FormProps, useFetcher, Link } from "react-router-dom"; import { styled } from "@ailiyah-ui/factory"; import { createBox } from "@ailiyah-ui/box"; -import { capitalise, toSnakeCase } from "../helpers"; +import { capitalise, removeId, toSnakeCase } from "../helpers"; import { InputProps } from "./form.types"; import { AddButton } from "@ailiyah-ui/button"; import { AbstractDataType } from "../../handlers"; @@ -62,8 +62,8 @@ const Input = styled("input"); */ const Select = React.memo( React.forwardRef((props, ref) => { - let { url, name, ...rest } = props; - name = name + "Id"; + let { name, ...rest } = props; + const url = removeId(name); const fetcher = useFetcherData(url); const data = fetcher.data ? (fetcher.data as unknown as Array | null) @@ -77,6 +77,7 @@ const Select = React.memo( aria-label={`${name}-select`} ref={ref} > +