Commit 1e672508 authored by Krit Punpreuk's avatar Krit Punpreuk

Update perform.js

parent a7e502de
...@@ -60,17 +60,29 @@ function perform_function(context,request,response){ ...@@ -60,17 +60,29 @@ function perform_function(context,request,response){
} }
} }
send_request(option,function(err){
if(!err){
response.success();
}else{
response.error(err);
}
})
}
function send_request(option,cb){
request(option, function (error, resp, body) { request(option, function (error, resp, body) {
if (!error && resp.statusCode == 200) { if (!error && resp.statusCode == 200) {
response.success(); var r = JSON.parse(body);
if(r.status==200){
cb();
}else{
cb(new Error("send error"));
}
}else if(!reject){ }else if(!reject){
response.success(); cb()
}else{ }else{
response.reject(); cb(error)
} }
}); });
} }
module.exports = perform_function; module.exports = perform_function;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment