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}
115
116export async function addModifyPost(requestData, type) {
117 let API;
118 let requestBody;
119 assertPostContentWithinLimit(requestData.content.Content);
120 if (type === 'new') {
121 API = CREATE_POST_API;
122 requestBody = {
123 title: requestData.content.Title,
124 content: requestData.content.Content,
125 tags: []
126 };
127 } else if (type === 'edit') {
128 API = MODIFY_CONTENT_API;
129 requestBody = {
130 contentId: requestData.PostID.toString(),
131 title: requestData.content.Title,
132 content: requestData.content.Content,
133 tags: []
134 };
135 } else {
136 throw new Error(`Invalid type specified for addModifyPost: ${type}`);
137 }
138
139 await requestSuccessfulMutation(API, requestBody, `${type} post`);
140}
141
142export async function addComment(parentId, commentContent) {
143 assertPostContentWithinLimit(commentContent);

Callers 1

actionFunction · 0.90

Calls 2

Tested by

no test coverage detected