diff --git a/server/controllers/routes/admin/cohort/deleteCohort.js b/server/controllers/routes/admin/cohort/deleteCohort.js index bf408c87..c65377fb 100644 --- a/server/controllers/routes/admin/cohort/deleteCohort.js +++ b/server/controllers/routes/admin/cohort/deleteCohort.js @@ -1,14 +1,15 @@ const deleteCohort = require('../../../../database/queries/cohort/deleteCohort'); -const cohortDelete = (req, res, next) => { - deleteCohort(req.params.cohortId) - .then(() => - res.json({ - StatusCode: 200, - data: { message: 'Cohort deleted successfully' }, - }), - ) - .catch(next); +const cohortDelete = async (req, res, next) => { + try { + await deleteCohort(req.params.cohortId); + res.json({ + StatusCode: 200, + data: { message: 'Cohort deleted successfully' }, + }); + } catch (err) { + next(err); + } }; module.exports = {