createInvite forgot to Promise properly

This commit is contained in:
abalabahaha
2016-02-25 18:27:33 -08:00
parent beb44b7bfa
commit 159602b359
2 changed files with 29 additions and 36 deletions

View File

@@ -976,12 +976,7 @@ var InternalClient = (function () {
InternalClient.prototype.createInvite = function createInvite(chanServ, options) { InternalClient.prototype.createInvite = function createInvite(chanServ, options) {
var _this26 = this; var _this26 = this;
chanServ = this.resolver.resolveChannel(chanServ); return this.resolver.resolveChannel(chanServ).then(function (channel) {
if (!chanServ) {
throw new Error("couldn't resolve where");
}
if (!options) { if (!options) {
options = { options = {
validate: null validate: null
@@ -993,9 +988,10 @@ var InternalClient = (function () {
options.xkcdpass = options.xkcd || false; options.xkcdpass = options.xkcd || false;
} }
return this.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(chanServ.id), true, options).then(function (res) { return _this26.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(channel.id), true, options).then(function (res) {
return new _StructuresInvite2["default"](res, _this26.channels.get("id", res.channel.id), _this26.client); return new _StructuresInvite2["default"](res, _this26.channels.get("id", res.channel.id), _this26.client);
}); });
});
}; };
//def deleteInvite //def deleteInvite

View File

@@ -786,12 +786,8 @@ export default class InternalClient {
// def createInvite // def createInvite
createInvite(chanServ, options) { createInvite(chanServ, options) {
chanServ = this.resolver.resolveChannel(chanServ); return this.resolver.resolveChannel(chanServ)
.then(channel => {
if (!chanServ) {
throw new Error("couldn't resolve where");
}
if (!options) { if (!options) {
options = { options = {
validate: null validate: null
@@ -803,8 +799,9 @@ export default class InternalClient {
options.xkcdpass = options.xkcd || false; options.xkcdpass = options.xkcd || false;
} }
return this.apiRequest("post", Endpoints.CHANNEL_INVITES(chanServ.id), true, options) return this.apiRequest("post", Endpoints.CHANNEL_INVITES(channel.id), true, options)
.then(res => new Invite(res, this.channels.get("id", res.channel.id), this.client)); .then(res => new Invite(res, this.channels.get("id", res.channel.id), this.client));
});
} }
//def deleteInvite //def deleteInvite