MCPcopy Create free account
hub / github.com/EpistasisLab/KRAGEN / fetchData

Function fetchData

KRAGEN_Dashboard/Frontend/src/components/apiService.js:30–50  ·  view source on GitHub ↗
(endpoint, method, body = null)

Source from the content-addressed store, hash-verified

28 let endpoint = `${apiUrl}:${apiPort}/chatapi/v1/chats/${current_chatTapID}/chatlogs`;
29
30 async function fetchData(endpoint, method, body = null) {
31 const options = {
32 method: method,
33 headers: {
34 "Content-Type": "application/json",
35 },
36 };
37
38 if (body) {
39 options.body = JSON.stringify(body);
40 }
41
42 try {
43 const response = await fetch(endpoint, options);
44 const data = await response.json();
45 return data;
46 } catch (err) {
47 console.error(`Error in fetchData for ${endpoint}:`, err);
48 throw err;
49 }
50 }
51
52 let data = await fetchData(endpoint, "GET");
53 return data;

Callers 1

getAllChatsFromDBFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected