Commit d41d283d authored by Caleb Weeks's avatar Caleb Weeks

adding slingql function

parent 4dc00b58
......@@ -755,8 +755,8 @@ SC.post = function(path,params,cb){
if(!cb){
return new Promise((resolve, reject)=>{
this.post(path, params, (err, data) =>{
err ? reject(new Error(err)) : resolve(data)
this.post(path, params, (err, httpStatusCode, httpResponse, body) =>{
err ? reject(new Error(err)) : resolve({statusCode: httpStatusCode, response:httpResponse, body})
});
});
}else{
......@@ -990,6 +990,16 @@ SC.cacheableClone = function(){
return this.clone({inMemoryCache: {}});
}
SC.slingql = async function(slingQlQuery){
let {body} = await this.post('/bin/slingql', slingQlQuery);
if(body) {
let {data} = JSON.parse(body);
return data;
} else {
throw new Error('No data returned from Slingql query');
}
}
//////////////////////////////////////////////////////////////////////////
......
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