From 7dab718694c662ef00fa2a662be565b011064f08 Mon Sep 17 00:00:00 2001 From: Matthias Damm Date: Sat, 10 Aug 2019 17:41:22 +0200 Subject: [PATCH] remove nested promise --- controllers/helpers/taskrouter-helper.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/controllers/helpers/taskrouter-helper.js b/controllers/helpers/taskrouter-helper.js index e8c3899..3c15ae9 100644 --- a/controllers/helpers/taskrouter-helper.js +++ b/controllers/helpers/taskrouter-helper.js @@ -16,17 +16,7 @@ module.exports.createTask = function (workflowSid, attributes) { taskChannel: 'voice' } - return new Promise((resolve, reject) => { - - client.taskrouter.workspaces(process.env.TWILIO_WORKSPACE_SID).tasks.create(data) - .then(task => { - resolve(task) - }).catch(error => { - reject(error) - }) - - }) - + return client.taskrouter.workspaces(process.env.TWILIO_WORKSPACE_SID).tasks.create(data) } module.exports.getOngoingTasks = function (name) {