MCPcopy Create free account
hub / github.com/codelitdev/courselit / onCourseDelete

Function onCourseDelete

packages/app/components/Admin/CourseEditor.js:246–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244 };
245
246 const onCourseDelete = async () => {
247 const query = `
248 mutation {
249 result: deleteCourse(id: "${courseData.course.id}")
250 }
251 `;
252
253 try {
254 props.dispatch(networkAction(true));
255 const response = await queryGraphQL(
256 `${BACKEND}/graph`,
257 query,
258 props.auth.token
259 );
260
261 if (response.result) {
262 setCourseData(
263 Object.assign({}, courseData, {
264 course: initCourseMetaData,
265 })
266 );
267 props.closeEditor();
268 }
269 } catch (err) {
270 setError(err.message);
271 } finally {
272 props.dispatch(networkAction(false));
273 }
274 };
275
276 const setCourseDataWithDescription = (course) => {
277 setCourseData(

Callers

nothing calls this directly

Calls 3

networkActionFunction · 0.90
queryGraphQLFunction · 0.90
setErrorFunction · 0.85

Tested by

no test coverage detected