MCPcopy Create free account
hub / github.com/Packstack-Tech/packstack / getData

Function getData

frontend/src/app/PackForm/PackForm.tsx:49–63  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

47 }, [packId]);
48
49 async function getData(id: number) {
50 try {
51 const pack = await getPack(id);
52 const { items, userId, title } = pack;
53 if (user && user.id !== userId) {
54 history.push(getPackPath(id, title));
55 return;
56 }
57 setPackData(pack);
58 setPackItems(items);
59 setLoading(false);
60 } catch (e) {
61 alertError({ message: 'Unable to retrieve pack information.' })
62 }
63 }
64
65 const addItem = (item: Item) => {
66 const items = Object.assign([], [...packItems, { ...item, packItem: { notes: '', quantity: 1, worn: false } }]);

Callers 1

fetchDataFunction · 0.85

Calls 2

getPackPathFunction · 0.90
alertErrorFunction · 0.90

Tested by

no test coverage detected