fix(striker-ui): allow set detail url prefix in CRUD list

main
Tsu-ba-me 11 months ago
parent 5ad591cdc0
commit c8e7994ab9
  1. 4
      striker-ui/components/CrudList.tsx
  2. 1
      striker-ui/types/CrudList.d.ts

@ -39,6 +39,8 @@ const CrudList = <
renderDeleteItem, renderDeleteItem,
renderEditForm, renderEditForm,
renderListItem, renderListItem,
// Dependents
entryUrlPrefix = entriesUrl,
} = props; } = props;
const addDialogRef = useRef<DialogForwardedRefContent>(null); const addDialogRef = useRef<DialogForwardedRefContent>(null);
@ -72,7 +74,7 @@ const CrudList = <
const { fetch: getEntry, loading: loadingEntry } = useActiveFetch<Detail>({ const { fetch: getEntry, loading: loadingEntry } = useActiveFetch<Detail>({
onData: (data) => setEntry(data), onData: (data) => setEntry(data),
url: entriesUrl, url: entryUrlPrefix,
}); });
const addHeader = useMemo<React.ReactNode>( const addHeader = useMemo<React.ReactNode>(

@ -24,6 +24,7 @@ type DeletePromiseChainGetter<T> = (
) => Promise<T>[]; ) => Promise<T>[];
type CrudListOptionalProps<Overview> = { type CrudListOptionalProps<Overview> = {
entryUrlPrefix?: string;
getAddLoading?: (previous?: boolean) => boolean; getAddLoading?: (previous?: boolean) => boolean;
getDeletePromiseChain?: <T>( getDeletePromiseChain?: <T>(
base: DeletePromiseChainGetter<T>, base: DeletePromiseChainGetter<T>,

Loading…
Cancel
Save