Return the task object when adding a task

This commit is contained in:
Dan Morphis authored and Zaid Abdulla committed 2015-05-31 13:38:15 +03:00
1 parent ff68553bd7
commit b17f842de7
1 file changed
+8 -8
+8 -8
View File
@@ -196,21 +196,21 @@ listener = (request, response) ->
if urlParts.query.connection_request? if urlParts.query.connection_request?
apiFunctions.connectionRequest(deviceId, (err) -> apiFunctions.connectionRequest(deviceId, (err) ->
if err if err
response.writeHead(202) response.writeHead(202, {'Content-Type' : 'application/json'})
response.end() response.end(JSON.stringify(task))
else else
apiFunctions.watchTask(task._id, config.get('DEVICE_ONLINE_THRESHOLD', deviceId), (err) -> apiFunctions.watchTask(task._id, config.get('DEVICE_ONLINE_THRESHOLD', deviceId), (err) ->
if err if err
response.writeHead(202) response.writeHead(202, {'Content-Type' : 'application/json'})
response.end() response.end(JSON.stringify(task))
return return
response.writeHead(200) response.writeHead(200, {'Content-Type' : 'application/json'})
response.end() response.end(JSON.stringify(task))
) )
) )
else else
response.writeHead(202) response.writeHead(202, {'Content-Type' : 'application/json'})
response.end() response.end(JSON.stringify(task))
) )
) )
else if urlParts.query.connection_request? else if urlParts.query.connection_request?