MCPcopy
hub / github.com/suitenumerique/docs / fetchAPI

Function fetchAPI

src/frontend/apps/impress/src/api/fetchApi.ts:8–31  ·  view source on GitHub ↗
(
  input: string,
  init?: FetchAPIInit,
  apiVersion = '1.0',
)

Source from the content-addressed store, hash-verified

6}
7
8export const fetchAPI = async (
9 input: string,
10 init?: FetchAPIInit,
11 apiVersion = '1.0',
12) => {
13 const apiUrl = `${baseApiUrl(apiVersion)}${input}`;
14 const csrfToken = getCSRFToken();
15
16 const headers = {
17 'Content-Type': 'application/json',
18 ...init?.headers,
19 ...(csrfToken && { 'X-CSRFToken': csrfToken }),
20 };
21
22 if (init?.withoutContentType) {
23 delete headers?.['Content-Type' as keyof typeof headers];
24 }
25
26 return await fetch(apiUrl, {
27 ...init,
28 credentials: 'include',
29 headers,
30 });
31};

Callers 15

updateUserFunction · 0.90
getConfigFunction · 0.90
getMeFunction · 0.90
userReconciliationsFunction · 0.90
onboardingDoneFunction · 0.90
DocsThreadStoreClass · 0.90
refreshThreadMethod · 0.90
initThreadsMethod · 0.90
getDocTreeFunction · 0.90
detachDocFunction · 0.90
getDocChildrenFunction · 0.90
getDocsTrashbinFunction · 0.90

Calls 3

baseApiUrlFunction · 0.90
getCSRFTokenFunction · 0.90
fetchFunction · 0.85

Tested by

no test coverage detected