Commit 63cb7cf3 authored by Jake Oliversen's avatar Jake Oliversen

Added post and import promises

parent 9d44a1c5
......@@ -615,12 +615,8 @@ SC.import = function(path, data, options, callback){
* @param {function} callback - to call upon completion (err, httpStatusCode, httpResponse, body)
*/
SC.post = function(path,params,cb){
var sc_self=this;
params=params||{};
params._charset_ = params._charset_ || "utf-8";
if(!cb || typeof(cb) !== "function"){
if(!cb || typeof(cb) !== "function"){
return new Promise((resolve, reject)=>{
this.post(path, params, (err, data) =>{
err ? reject(new Error(err)) : resolve(data)
......@@ -628,6 +624,10 @@ SC.post = function(path,params,cb){
})
}
var sc_self=this;
params=params||{};
params._charset_ = params._charset_ || "utf-8";
var settings={
url: this.buildUri(path),
timeout: this.timeout,
......
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