MCPcopy Create free account
hub / github.com/GooGee/Entity-Builder / ExampleList

Function ExampleList

src/View/Oapi/ExampleList.tsx:12–56  ·  view source on GitHub ↗
(property: Property)

Source from the content-addressed store, hash-verified

10}
11
12export default function ExampleList(property: Property) {
13 const sExamplezzStore = useExamplezzStore()
14 const sToastzzStore = useToastzzStore()
15
16 const [itemzz, setItemzz] = useState<LB.ExampleMap[]>([])
17
18 useEffect(() => {
19 refresh()
20 }, [property.requestId, property.responseId])
21
22 function refresh() {
23 makeExampleMapCRUD()
24 .findAll()
25 .then((response) =>
26 setItemzz(
27 response.filter(
28 (item) => item.requestId === property.requestId && item.responseId === property.responseId,
29 ),
30 ),
31 )
32 .catch(sToastzzStore.showError)
33 }
34
35 return (
36 <ItemList
37 fieldName="exampleId"
38 itemzz={itemzz}
39 source={sExamplezzStore.itemzz}
40 create={function (exampleId) {
41 return makeExampleMapCRUD()
42 .create({
43 exampleId,
44 requestId: property.requestId,
45 responseId: property.responseId,
46 })
47 .then(() => refresh())
48 }}
49 delete={function (id) {
50 return makeExampleMapCRUD()
51 .delete(id)
52 .then(() => refresh())
53 }}
54 ></ItemList>
55 )
56}

Callers

nothing calls this directly

Calls 4

makeExampleMapCRUDFunction · 0.90
refreshFunction · 0.70
createMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected