exports.create = (req, res) => {
if (!req.body.task) {
return res.status(400).send({
message: "Task Can't be empty",
});
}
const task = new Task({
task: req.body.task,
});
task.save()
.then((data) => {
res.send(data);
})
.catch((err) => {
res.status(500).send({
message: err.message || 'Some error occurred while creating the Task.',
});
});
};
I've been working on this function and despite trying different approaches to using return, I still encounter the following error:
Expected to return a value at the end of arrow function consistent-return on 1:29.
Seeking assistance in rectifying this issue. Any help would be appreciated.