Skip to content

Commit

Permalink
Merge pull request #1193 from isomerpages/fix/update-endpoint-not-ret…
Browse files Browse the repository at this point in the history
…urning-new-data

fix: send updated data back to client from all update pages endpoints
  • Loading branch information
jacobkwan authored Mar 12, 2024
2 parents aed11a7 + 75f513a commit c243784
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class CollectionPageService {
) {
const parsedCollectionName = `_${collectionName}`
const newContent = convertDataToMarkdown(frontMatter, content)
const {
frontMatter: newFrontMatter,
pageContent: newPageContent,
} = retrieveDataFromMarkdown(newContent)
const { newSha } = await this.gitHubService.update(sessionData, {
fileContent: newContent,
sha,
Expand All @@ -78,7 +82,7 @@ class CollectionPageService {
})
return {
fileName,
content: { frontMatter, pageBody: content },
content: { frontMatter: newFrontMatter, pageBody: newPageContent },
oldSha: sha,
newSha,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class ResourcePageService {
resourceCategoryName,
})
const newContent = convertDataToMarkdown(frontMatter, content)
const {
frontMatter: newFrontMatter,
pageContent: newPageContent,
} = retrieveDataFromMarkdown(newContent)
const { newSha } = await this.gitHubService.update(sessionData, {
fileContent: newContent,
sha,
Expand All @@ -101,7 +105,7 @@ class ResourcePageService {
})
return {
fileName,
content: { frontMatter, pageBody: content },
content: { frontMatter: newFrontMatter, pageBody: newPageContent },
oldSha: sha,
newSha,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class SubcollectionPageService {
) {
const parsedDirectoryName = `_${collectionName}/${subcollectionName}`
const newContent = convertDataToMarkdown(frontMatter, content)
const {
frontMatter: newFrontMatter,
pageContent: newPageContent,
} = retrieveDataFromMarkdown(newContent)
const { newSha } = await this.gitHubService.update(sessionData, {
fileContent: newContent,
sha,
Expand All @@ -77,7 +81,7 @@ class SubcollectionPageService {
})
return {
fileName,
content: { frontMatter, pageBody: content },
content: { frontMatter: newFrontMatter, pageBody: newPageContent },
oldSha: sha,
newSha,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class UnlinkedPageService {

async update(sessionData, { fileName, content, frontMatter, sha }) {
const newContent = convertDataToMarkdown(frontMatter, content)
const {
frontMatter: newFrontMatter,
pageContent: newPageContent,
} = retrieveDataFromMarkdown(newContent)
const { newSha } = await this.gitHubService.update(sessionData, {
fileContent: newContent,
sha,
Expand All @@ -59,7 +63,7 @@ class UnlinkedPageService {
})
return {
fileName,
content: { frontMatter, pageBody: content },
content: { frontMatter: newFrontMatter, pageBody: newPageContent },
oldSha: sha,
newSha,
}
Expand Down

0 comments on commit c243784

Please sign in to comment.