Skip to content

Commit 0477661

Browse files
committedNov 13, 2019
Добавил иф на создание бухака
1 parent 0fc48de commit 0477661

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

Diff for: ‎routes/api/boohack.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ router.post('/boohack/new', auth.required, function(req, res, next){
2626
// должно быть все ок
2727
boohack.bars = req.body.boohack.bars
2828

29-
boohack.save().then(function(){
30-
return res.json({boohack: boohack.toJSONFor()});
31-
}).catch(next);
29+
if(boohack.bars){
30+
boohack.bars = req.body.boohack.bars
31+
boohack.save().then(function(){
32+
return res.json({boohack: boohack.toJSONFor()});
33+
}).catch(next);
34+
}else{
35+
console.err("BooHack bars не работает");
36+
}
3237
});
3338

3439
module.exports = router;

0 commit comments

Comments
 (0)