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

Function projectScopedUrl

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

Source from the content-addressed store, hash-verified

63}
64
65export function projectScopedUrl(url, init) {
66 if (!selectedProjectId || typeof url !== "string" || !url.startsWith("/")) return url;
67 if (
68 !isScopedApiUrl(url, "/api/plugins") &&
69 !isScopedApiUrl(url, "/api/automation") &&
70 !isScopedApiUrl(url, "/api/capabilities") &&
71 !isScopedApiUrl(url, "/api/settings")
72 ) {
73 return url;
74 }
75 return `/api/projects/${encodeURIComponent(selectedProjectId)}${url.slice("/api".length)}`;
76}
77
78export function authedFetch(url, init) {
79 return fetch(projectScopedUrl(url, init), init);

Callers 1

authedFetchFunction · 0.85

Calls 1

isScopedApiUrlFunction · 0.85

Tested by

no test coverage detected