MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / requestSuccessfulMutation

Function requestSuccessfulMutation

src/Data/PostData.js:152–165  ·  view source on GitHub ↗
(API, requestBody, action)

Source from the content-addressed store, hash-verified

150}
151
152async function requestSuccessfulMutation(API, requestBody, action) {
153 const response = await apiRequest(API, {body: requestBody});
154 try {
155 const result = await response.json();
156 if (!result.success) {
157 throw new Error(result.error || `API request failed for ${action}.`);
158 }
159 } catch (error) {
160 if (error instanceof SyntaxError && response.ok) {
161 return;
162 }
163 throw error;
164 }
165}

Callers 4

toggleLikeContentFunction · 0.85
removeContentFunction · 0.85
addModifyPostFunction · 0.85
addCommentFunction · 0.85

Calls 1

apiRequestFunction · 0.90

Tested by

no test coverage detected