MCPcopy Create free account
hub / github.com/PartPilotLab/PartPilot / getParts

Function getParts

app/dashboardPage.tsx:243–265  ·  view source on GitHub ↗
(page: number)

Source from the content-addressed store, hash-verified

241 }
242
243 async function getParts(page: number) {
244 setLoading(true);
245 try {
246 const res = await fetch("/api/parts?page=" + page).then(
247 (response) =>
248 response.json().then((data) => ({
249 status: response.status,
250 body: data,
251 }))
252 );
253 if (res.status !== 200) {
254 throw new Error(res.body.message);
255 }
256 const response = res.body.parts as PartState[];
257 if (response) {
258 setParts(response);
259 }
260 // setParts(res.body);
261 } catch (e: ErrorCallback | any) {
262 console.error(e.message);
263 }
264 setLoading(false);
265 }
266
267 async function clearSearch() {
268 setIsSearchResult(false);

Callers 4

clearSearchFunction · 0.85
getPartInfoFromLCSCFunction · 0.85
deletePartFunction · 0.85
navigatePageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected