master
Karolin Rafalski 7 years ago
parent cbc872af50
commit 82dc1a7630

@ -5,11 +5,9 @@ const Holiday = require('../models/holidays.js')
holidays.post('/', async (req, res) => { holidays.post('/', async (req, res) => {
Holiday.create(req.body, (error, createdHoliday) => { Holiday.create(req.body, (error, createdHoliday) => {
if (error) { if (error) {
console.log(error) res.status(400).json({ error: error })
res.status(418).json({ error: error })
} else {
res.status(200).send(createdHoliday) // .json() will send proper headers in response so client knows it's json coming back
} }
res.status(200).send(createdHoliday) // .json() will send proper headers in response so client knows it's json coming back
}) })
}) })

Loading…
Cancel
Save