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

Function addModifyPost

src/Data/PostData.js:116–140  ·  view source on GitHub ↗
(requestData, type)

Source from the content-addressed store, hash-verified

114 title,
115 content: requestData.content.Content,
116 };
117 } else if (type === 'edit') {
118 API = MODIFY_CONTENT_API;
119 requestBody = {
120 contentId: requestData.PostID.toString(),
121 title,
122 content: requestData.content.Content,
123 };
124 } else {
125 throw new Error(`Invalid type specified for addModifyPost: ${type}`);
126 }
127
128 await requestSuccessfulMutation(API, requestBody, `${type} post`);
129}
130
131export async function addComment(parentId, commentContent) {
132 assertPostContentWithinLimit(commentContent);
133 const requestBody = {
134 parentId: parentId.toString(),
135 content: commentContent,
136 };
137
138 await requestSuccessfulMutation(CREATE_COMMENT_API, requestBody, 'creating comment');
139}
140
141async function requestSuccessfulMutation(API, requestBody, action) {
142 const response = await apiRequest(API, {body: requestBody});
143 try {

Callers 1

actionFunction · 0.90

Calls 2

Tested by

no test coverage detected