Skip to content

Commit

Permalink
hotfix: properly handle subcollection file update
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderleegs committed Sep 20, 2021
1 parent 1a1d792 commit 02d3b03
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions newroutes/collectionPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,28 @@ class CollectionPagesRouter {
sha,
})
}
}
if (newFileName) {
updateResp = await this.collectionPageService.rename(reqDetails, {
oldFileName: pageName,
newFileName,
collectionName,
content: pageBody,
frontMatter,
sha,
})
} else {
updateResp = await this.collectionPageService.update(reqDetails, {
fileName: pageName,
collectionName,
content: pageBody,
frontMatter,
sha,
})
/* eslint-disable no-lonely-if */
if (newFileName) {
updateResp = await this.collectionPageService.rename(reqDetails, {
oldFileName: pageName,
newFileName,
collectionName,
content: pageBody,
frontMatter,
sha,
})
} else {
updateResp = await this.collectionPageService.update(reqDetails, {
fileName: pageName,
collectionName,
content: pageBody,
frontMatter,
sha,
})
}
}

/* eslint-enable no-lonely-if */
return res.status(200).json(updateResp)
}

Expand Down

0 comments on commit 02d3b03

Please sign in to comment.