MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / fetchJSON

Function fetchJSON

dashboard/shell/src/sdk.jsx:82–98  ·  view source on GitHub ↗
(url, init)

Source from the content-addressed store, hash-verified

80}
81
82export async function fetchJSON(url, init) {
83 const res = await authedFetch(url, init);
84 if (!res.ok) {
85 let detail = `${res.status} ${res.statusText}`;
86 let body;
87 try {
88 body = await res.json();
89 if (body && body.detail) detail = String(body.detail);
90 } catch {
91 /* non-JSON error body */
92 }
93 const error = new Error(detail);
94 if (body !== undefined) error.body = body;
95 throw error;
96 }
97 return res.json();
98}
99
100function relativeTime(deltaSeconds) {
101 if (Number.isNaN(deltaSeconds)) return "unknown";

Callers 10

api.tsFile · 0.90
AppFunction · 0.90
postAutomationRunFunction · 0.90
postManagedSkillActionFunction · 0.90
api.tsFile · 0.90
api.tsFile · 0.90
api.tsFile · 0.90
StoreHealthCardFunction · 0.90
AppFunction · 0.90
api.tsFile · 0.90

Calls 1

authedFetchFunction · 0.85

Tested by

no test coverage detected