Skip to content

Commit

Permalink
Merge pull request #77 from contentstack/feature/reference-poc
Browse files Browse the repository at this point in the history
feat(live preview): reference poc for query
  • Loading branch information
uttamukkoji authored Jul 26, 2022
2 parents cb5fcbf + 44f2233 commit e657f36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export function sendRequest(queryObject, options) {
options
);
} else {
_data.entries.forEach(async (entry) => {
await Promise.all(_data.entries.map(async (entry) => {
await updateLivePreviewReferenceEntry(
referencesToBeResolvedMap,
entry,
Expand All @@ -383,7 +383,7 @@ export function sendRequest(queryObject, options) {
options

);
})
}))
}

}
Expand Down Expand Up @@ -503,7 +503,7 @@ async function updateLivePreviewReferenceEntry(referenceMap, entry, livePreview,

const includeReference = getIncludeParamForReference(referenceMap)
referenceRequestParam.body.include = includeReference
referenceRequestParam.body.live_preview = livePreview.hash
referenceRequestParam.body.live_preview = livePreview.live_preview
referenceRequestParam.body.content_type_uid = livePreviewContentTypeUid

const livePreviewUrl = livePreview.host.match(
Expand All @@ -527,6 +527,7 @@ async function updateLivePreviewReferenceEntry(referenceMap, entry, livePreview,
setReference(data.entry);

} catch (err) {
console.log("errror", err)
}
} else {

Expand Down
1 change: 1 addition & 0 deletions src/core/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export default class Stack {
if (this.live_preview) {
this.live_preview.live_preview = query.live_preview;
this.live_preview.content_type_uid = query.content_type_uid;
this.live_preview.entry_uid = query.entry_uid
}
}

Expand Down

0 comments on commit e657f36

Please sign in to comment.