@learnpack/learnpack 5.0.318 → 5.0.320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,7 +76,7 @@ const SyllabusEditor: React.FC = () => {
76
76
  }, [syllabus, navigate])
77
77
 
78
78
  useEffect(() => {
79
- ;(async () => {
79
+ ; (async () => {
80
80
  const { token } = checkParams(["token"])
81
81
  if (token) {
82
82
  const user = await loginWithToken(token)
@@ -242,23 +242,34 @@ const SyllabusEditor: React.FC = () => {
242
242
 
243
243
  setIsGenerating(true)
244
244
 
245
- const timeout = setTimeout(() => {
246
- cleanAll()
247
- window.location.href = `/preview/${syllabus.courseInfo.slug}?token=${auth.bcToken}&language=${syllabus.courseInfo.language}&mode=${mode}`
248
- }, 8000)
245
+ let contentIndex = syllabus.courseInfo.contentIndex
246
+
247
+ if (uploadedFiles.length > 0) {
248
+ contentIndex = contentIndex + " " + uploadedFiles.map((f) => `<FILE name="${f.name}">${f.text}</FILE>`).join("\n")
249
+ }
250
+
251
+ const extendedSyllabus = {
252
+ ...syllabus,
253
+ courseInfo: {
254
+ ...syllabus.courseInfo,
255
+ contentIndex: contentIndex,
256
+ },
257
+ }
258
+
249
259
  try {
250
- await createCourse(syllabus, tokenToUse, auth.bcToken)
260
+ await createCourse(extendedSyllabus, tokenToUse, auth.bcToken)
261
+ setTimeout(() => {
262
+ cleanAll()
263
+ window.location.href = `/preview/${syllabus.courseInfo.slug}?token=${auth.bcToken}&language=${syllabus.courseInfo.language}&mode=${mode}`
264
+ }, 2000)
251
265
  } catch (error) {
252
266
  console.error("Failed to create course:", error)
253
- clearTimeout(timeout)
254
267
  setIsGenerating(false)
255
268
  }
256
269
  }
257
270
 
258
271
  if (!syllabus) return null
259
272
 
260
- console.log(syllabus.courseInfo)
261
-
262
273
  return isGenerating ? (
263
274
  <>
264
275
  <Loader