|
|
|
|
@ -90,7 +90,7 @@ export const api = { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
saveCourse: (courseObject, accessToken) => { |
|
|
|
|
const isAdding = (!courseObject.hasOwnProperty('id') || !courseObject.hasOwnProperty('id')); |
|
|
|
|
const isAdding = !courseObject.id; |
|
|
|
|
|
|
|
|
|
let deferredStart = null; |
|
|
|
|
if (courseObject.is_deferred) { |
|
|
|
|
@ -114,7 +114,7 @@ export const api = { |
|
|
|
|
access_duration: courseObject.is_paid && courseObject.access_duration || 0, |
|
|
|
|
is_featured: courseObject.is_featured, |
|
|
|
|
slug: (courseObject.slug || '').toLowerCase(), |
|
|
|
|
date: (courseObject.date) ? courseObject.date.value:null, |
|
|
|
|
date: (courseObject.date) ? courseObject.date.value : null, |
|
|
|
|
stream: courseObject.stream, |
|
|
|
|
cover: courseObject.coverImageId ? courseObject.coverImageId : null, |
|
|
|
|
gallery: { |
|
|
|
|
@ -212,14 +212,14 @@ export const api = { |
|
|
|
|
}, |
|
|
|
|
convertContentJson: (contentJson, forSaving) => { |
|
|
|
|
if(forSaving){ |
|
|
|
|
return contentJson.map((block, index) => { |
|
|
|
|
let content = contentJson.map((block, index) => { |
|
|
|
|
if (block.type === 'text') { |
|
|
|
|
return { |
|
|
|
|
'type': 'text', |
|
|
|
|
'data': { |
|
|
|
|
'id': block.data.id ? block.data.id : null, |
|
|
|
|
'uuid': block.uuid, |
|
|
|
|
'position': ++index, |
|
|
|
|
'position': index + 1, |
|
|
|
|
'title': block.data.title, |
|
|
|
|
'txt': block.data.text, |
|
|
|
|
} |
|
|
|
|
@ -230,7 +230,7 @@ export const api = { |
|
|
|
|
'data': { |
|
|
|
|
'id': block.data.id ? block.data.id : null, |
|
|
|
|
'uuid': block.uuid, |
|
|
|
|
'position': ++index, |
|
|
|
|
'position': index + 1, |
|
|
|
|
'title': block.data.title, |
|
|
|
|
'img': block.data.image_id, |
|
|
|
|
} |
|
|
|
|
@ -241,7 +241,7 @@ export const api = { |
|
|
|
|
'data': { |
|
|
|
|
'id': block.data.id ? block.data.id : null, |
|
|
|
|
'uuid': block.uuid, |
|
|
|
|
'position': ++index, |
|
|
|
|
'position': index + 1, |
|
|
|
|
'title': block.data.title, |
|
|
|
|
'img': block.data.image_id, |
|
|
|
|
'txt': block.data.text, |
|
|
|
|
@ -253,7 +253,7 @@ export const api = { |
|
|
|
|
'data': { |
|
|
|
|
'id': block.data.id ? block.data.id : null, |
|
|
|
|
'uuid': block.uuid, |
|
|
|
|
'position': ++index, |
|
|
|
|
'position': index + 1, |
|
|
|
|
'title': block.data.title, |
|
|
|
|
'images': api.convertGalleryImagesJson(block.data.images), |
|
|
|
|
} |
|
|
|
|
@ -271,6 +271,7 @@ export const api = { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return content; |
|
|
|
|
} |
|
|
|
|
return contentJson.sort((a, b) => { |
|
|
|
|
if (a.position < b.position) { |
|
|
|
|
|