From 82dc1a76304b433c367622c84521c365136471d2 Mon Sep 17 00:00:00 2001 From: Karolin Rafalski Date: Sun, 5 May 2019 12:36:54 -0400 Subject: [PATCH] fix cors --- controllers/holidays.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/controllers/holidays.js b/controllers/holidays.js index 9763ea5..e3cfabe 100644 --- a/controllers/holidays.js +++ b/controllers/holidays.js @@ -5,11 +5,9 @@ const Holiday = require('../models/holidays.js') holidays.post('/', async (req, res) => { Holiday.create(req.body, (error, createdHoliday) => { if (error) { - console.log(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(400).json({ error: error }) } + res.status(200).send(createdHoliday) // .json() will send proper headers in response so client knows it's json coming back }) })