commit
f532c1c6fb
|
@ -346,11 +346,9 @@ exports.handle = function(apiVersion, functionName, fields, req, res)
|
||||||
function callAPI(apiVersion, functionName, fields, req, res)
|
function callAPI(apiVersion, functionName, fields, req, res)
|
||||||
{
|
{
|
||||||
//put the function parameters in an array
|
//put the function parameters in an array
|
||||||
var functionParams = [];
|
var functionParams = version[apiVersion][functionName].map(function (field) {
|
||||||
for(var i=0;i<version[apiVersion][functionName].length;i++)
|
return fields[field]
|
||||||
{
|
})
|
||||||
functionParams.push(fields[ version[apiVersion][functionName][i] ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//add a callback function to handle the response
|
//add a callback function to handle the response
|
||||||
functionParams.push(function(err, data)
|
functionParams.push(function(err, data)
|
||||||
|
@ -377,5 +375,5 @@ function callAPI(apiVersion, functionName, fields, req, res)
|
||||||
});
|
});
|
||||||
|
|
||||||
//call the api function
|
//call the api function
|
||||||
api[functionName](functionParams[0],functionParams[1],functionParams[2],functionParams[3],functionParams[4]);
|
api[functionName].apply(this, functionParams);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue