0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 06:32:39 +00:00

Fixed issue with arrays not being saved

This commit is contained in:
Scott Tolksdorf
2017-01-10 15:38:13 -05:00
parent e77532acef
commit 0878439750
4 changed files with 40 additions and 3 deletions

View File

@@ -30,12 +30,15 @@ router.post('/api/brew', (req, res, next)=>{
//Update
router.put('/api/brew/:editId', mw.loadBrew, (req, res, next)=>{
console.log(req.account);
const brew = req.body || {};
if(req.account){
brew.authors = _.uniq(_.concat(brew.authors, req.account.username));
}
console.log(brew);
BrewData.update(req.params.editId, brew)
.then((brew) => {
console.log(brew.toJSON());
return res.json(brew.toJSON());
})
.catch(next);