Improving props drilling for resources and resources path
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
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,
|
||||
@@ -9,11 +11,14 @@ type NewProps = {
|
||||
|
||||
const New = <T,>(props: NewProps) => {
|
||||
const { schemaName, resource, uiSchema } = props;
|
||||
const { currentFirm } = useContext(FirmContext);
|
||||
const resourceBasePath = `firm/${currentFirm.instance}/${currentFirm.firm}`
|
||||
|
||||
return (
|
||||
<CrudForm
|
||||
schemaName={schemaName}
|
||||
uiSchema={uiSchema}
|
||||
resourceBasePath={resourceBasePath}
|
||||
resource={resource}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user