Skip to content

Commit

Permalink
Merge pull request #302 from isomerpages/hotfix-properly-handle-renam…
Browse files Browse the repository at this point in the history
…ing-of-subcollection-page

Hotfix(develop): properly handle renaming of subcollection page
  • Loading branch information
alexanderleegs authored Sep 20, 2021
2 parents f35acfb + 02d3b03 commit ab63979
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 ab63979

Please sign in to comment.