30 lines
764 B
TypeScript
30 lines
764 B
TypeScript
import { CrudForm } from "../../../lib/crud/components/crud-form";
|
|
import { UiSchema } from "@rjsf/utils";
|
|
import { useContext } from "react";
|
|
import { FirmContext } from "../../../contexts/FirmContext";
|
|
|
|
type NewProps = {
|
|
resource: string,
|
|
schemaName: string,
|
|
uiSchema?: UiSchema,
|
|
defaultValue?: any
|
|
}
|
|
|
|
const New = <T,>(props: NewProps) => {
|
|
const { schemaName, resource, uiSchema, defaultValue } = props;
|
|
const { currentFirm } = useContext(FirmContext);
|
|
const resourceBasePath = `firm/${currentFirm.instance}/${currentFirm.firm}`
|
|
|
|
return (
|
|
<CrudForm
|
|
schemaName={schemaName}
|
|
uiSchema={uiSchema}
|
|
resourceBasePath={resourceBasePath}
|
|
resource={resource}
|
|
defaultValue={defaultValue}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default New;
|