MCPcopy Index your code
hub / github.com/OpenSIST/OpenSIST.github.io / apiRequest

Function apiRequest

src/Data/Common.js:10–26  ·  view source on GitHub ↗
(path, {allowUnauthorized = false, body, contentType, fetchPriority, headers, ...options} = {})

Source from the content-addressed store, hash-verified

8}
9
10export async function apiRequest(path, {allowUnauthorized = false, body, contentType, fetchPriority, headers, ...options} = {}) {
11 const response = await fetch(path, {
12 method: 'POST',
13 credentials: 'include',
14 headers: {
15 ...createHeaders(contentType),
16 ...headers,
17 },
18 ...options,
19 ...(fetchPriority ? {priority: fetchPriority} : {}),
20 ...(body === undefined
21 ? {}
22 : {body: typeof body === 'string' ? body : JSON.stringify(body)}),
23 });
24 await handleErrors(response, {allowUnauthorized});
25 return response;
26}
27
28export async function apiJson(path, options) {
29 return (await apiRequest(path, options)).json();

Callers 15

handleVerifyFunction · 0.90
addModifyApplicantFunction · 0.90
removeApplicantFunction · 0.90
uploadAvatarFunction · 0.90
updateContactFunction · 0.90
collectProgramFunction · 0.90
uncollectProgramFunction · 0.90
getFileContentFunction · 0.90
addModifyFileFunction · 0.90
removeFileFunction · 0.90
addModifyRecordFunction · 0.90
removeRecordFunction · 0.90

Calls 2

createHeadersFunction · 0.85
handleErrorsFunction · 0.85

Tested by

no test coverage detected