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

Function loadCourse

packages/app/components/Admin/CourseEditor.js:287–318  ·  view source on GitHub ↗
(courseId)

Source from the content-addressed store, hash-verified

285 };
286
287 const loadCourse = async (courseId) => {
288 const query = `
289 query {
290 course: getCourse(id: "${courseId}") {
291 title,
292 cost,
293 published,
294 privacy,
295 isBlog,
296 description,
297 featuredImage,
298 id,
299 lessons {
300 id,
301 title
302 },
303 isFeatured,
304 slug,
305 courseId
306 }
307 }
308 `;
309
310 try {
311 const response = await executeGQLCall(query);
312 if (response.course) {
313 setCourseDataWithDescription(response.course);
314 }
315 } catch (err) {
316 setError(err.message);
317 }
318 };
319
320 const onFeaturedImageSelection = (url) =>
321 changeCourseDetails("featuredImage", url);

Callers 1

CourseEditor.jsFile · 0.85

Calls 2

setErrorFunction · 0.85

Tested by

no test coverage detected