mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: update details handling in video activities to use JSON strings
This commit is contained in:
parent
31b5104dd5
commit
260bd60c7a
4 changed files with 108 additions and 99 deletions
|
|
@ -75,14 +75,23 @@ export async function createExternalVideoActivity(
|
|||
data.chapter_id = chapter_id
|
||||
data.activity_id = activity.id
|
||||
|
||||
// Add video details if provided
|
||||
data.details = {
|
||||
startTime: data.startTime || 0,
|
||||
endTime: data.endTime || null,
|
||||
autoplay: data.autoplay || false,
|
||||
muted: data.muted || false
|
||||
// Add video details with null checking
|
||||
const defaultDetails = {
|
||||
startTime: 0,
|
||||
endTime: null,
|
||||
autoplay: false,
|
||||
muted: false
|
||||
}
|
||||
|
||||
const videoDetails = data.details ? {
|
||||
startTime: data.details.startTime ?? defaultDetails.startTime,
|
||||
endTime: data.details.endTime ?? defaultDetails.endTime,
|
||||
autoplay: data.details.autoplay ?? defaultDetails.autoplay,
|
||||
muted: data.details.muted ?? defaultDetails.muted
|
||||
} : defaultDetails
|
||||
|
||||
data.details = JSON.stringify(videoDetails)
|
||||
|
||||
const result = await fetch(
|
||||
`${getAPIUrl()}activities/external_video`,
|
||||
RequestBodyWithAuthHeader('POST', data, null, access_token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue