import { UiSchema } from "@rjsf/utils"; import { useContext } from "react"; import { useForm, useTranslation } from "@refinedev/core"; import { CrudForm } from "../../../lib/crud/components/crud-form"; import { FirmContext } from "../../../contexts/FirmContext"; import SaveIcon from "@mui/icons-material/Save"; import { Button } from "@mui/material"; type NewProps = { resource: string, schemaName: string, uiSchema?: UiSchema, defaultValue?: any } const New = (props: NewProps) => { const { schemaName, resource, uiSchema, defaultValue } = props; const { currentFirm } = useContext(FirmContext); const { translate: t } = useTranslation(); const resourceBasePath = `firm/${currentFirm.instance}/${currentFirm.firm}` const { onFinish } = useForm({ resource: `${resourceBasePath}/${resource}`, action: "create", redirect: "show", }); return ( onFinish(data)} > ) } export default New;