Skip to content

Commit

Permalink
checks that an update has content before updating language table
Browse files Browse the repository at this point in the history
  • Loading branch information
jhmullen committed Feb 1, 2019
1 parent 534b98d commit 55755f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cms/src/api/cmsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ module.exports = function(app) {
updateList.forEach(ref => {
app.post(`/api/cms/${ref}/update`, isEnabled, (req, res) => {
db[ref].update(req.body, {where: {id: req.body.id}}).then(o => {
if (contentTables.includes(ref)) {
if (contentTables.includes(ref) && req.body.content) {
req.body.content.forEach(content => {
db[`${ref}_content`].upsert(content, {where: {id: req.body.id, lang: content.lang}}).then(u => res.json(u).end());
});
Expand Down

0 comments on commit 55755f3

Please sign in to comment.