Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 17deacc

Browse files
author
John B
committed
generic id for crud geenric
1 parent c7147ba commit 17deacc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/headless/crud/generic.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const AddRoute = <A, Id>(
3535

3636
export const CrudGeneric =
3737
<A extends { id: Id }, Id>(
38-
ListGeneric: (a: ListProps<A>) => JSX.Element,
38+
ListGeneric: (a: ListProps<A, Id>) => JSX.Element,
3939
DetailGeneric: DetailGenericType<A, Id>,
4040
FormWDef: <A>(
4141
formDef: FormDef<A, number>[]
@@ -60,7 +60,7 @@ export const CrudGeneric =
6060

6161
export const CrudGenericWForm =
6262
<A extends { id: Id }, Id>(
63-
ListGeneric: (a: ListProps<A>) => JSX.Element,
63+
ListGeneric: (a: ListProps<A, Id>) => JSX.Element,
6464
DetailGeneric: DetailGenericType<A, Id>,
6565
Form: (p: FormProps<A>) => JSX.Element
6666
) =>
@@ -72,7 +72,7 @@ export const CrudGenericWForm =
7272
showEditToggle: boolean = true
7373
) => {
7474
const addLink = urlPrefix + "/add";
75-
const editLink = (childId: number | ":id") =>
75+
const editLink = (childId: Id | ":id") =>
7676
urlPrefix + "/" + childId + "/edit";
7777
const redirectUrl = urlPrefix;
7878
const backUrl = urlPrefix;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Types } from "@nexys/core-list";
2-
export interface ListProps<A> {
2+
export interface ListProps<A, Id> {
33
getData: () => Promise<A[]>;
44
addLink?: string;
5-
editLink?: (id: number) => string;
5+
editLink?: (id: Id) => string;
66
def: Types.Definition<A>;
77
config?: Types.Config<A>;
88
}

0 commit comments

Comments
 (0)