cannot take the resolve in a promise -
i trying take resolve of promise :
this.clientprov.createcustomer(this.config.gettenantid(), this.config.getstoreid(), this.firstname, this.lastname).then((customer:customer)=>{ console.log("into promise"); }); but createcustomer returns rejected response
clientprovider.prototype.createcustomer = function (tenantid, storeid, fname, lname) { var _this = this; var payload; if (storeid) { payload = { storeid: storeid }; } payload.firstname = fname; payload.lastname = lname; var promise = new promise(function (resolve, reject) { if (tenantid) { payload.tenant_id = tenantid; _this.api.api('post', '/v1/customer', payload) .then(function (response) { resolve(client_1.customer.fromjson(response)); }, function (response) { reject(response); }); } else { reject(); } }); return promise; }; does know that? thanks
Comments
Post a Comment