From c8e7994ab9bcbe719a1a0e8d8de1a923d549779d Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 6 Feb 2024 17:24:02 -0500 Subject: [PATCH] fix(striker-ui): allow set detail url prefix in CRUD list --- striker-ui/components/CrudList.tsx | 4 +++- striker-ui/types/CrudList.d.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/striker-ui/components/CrudList.tsx b/striker-ui/components/CrudList.tsx index 08ebb78e..3d94f310 100644 --- a/striker-ui/components/CrudList.tsx +++ b/striker-ui/components/CrudList.tsx @@ -39,6 +39,8 @@ const CrudList = < renderDeleteItem, renderEditForm, renderListItem, + // Dependents + entryUrlPrefix = entriesUrl, } = props; const addDialogRef = useRef(null); @@ -72,7 +74,7 @@ const CrudList = < const { fetch: getEntry, loading: loadingEntry } = useActiveFetch({ onData: (data) => setEntry(data), - url: entriesUrl, + url: entryUrlPrefix, }); const addHeader = useMemo( diff --git a/striker-ui/types/CrudList.d.ts b/striker-ui/types/CrudList.d.ts index 7247dc1e..fca66469 100644 --- a/striker-ui/types/CrudList.d.ts +++ b/striker-ui/types/CrudList.d.ts @@ -24,6 +24,7 @@ type DeletePromiseChainGetter = ( ) => Promise[]; type CrudListOptionalProps = { + entryUrlPrefix?: string; getAddLoading?: (previous?: boolean) => boolean; getDeletePromiseChain?: ( base: DeletePromiseChainGetter,