From 5e2ee2398ea5f7b30d8c1783be5cde05803e54fd Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Wed, 26 Oct 2016 19:42:21 +0100 Subject: [PATCH] Fix some destroy stuff (#828) --- src/client/Client.js | 18 ++++++++---------- src/client/rest/RESTMethods.js | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 58e7f595f..22163e77a 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -235,16 +235,14 @@ class Client extends EventEmitter { */ destroy() { return new Promise((resolve, reject) => { - this.manager.destroy().then(() => { - for (const t of this._timeouts) clearTimeout(t); - for (const i of this._intervals) clearInterval(i); - this._timeouts = []; - this._intervals = []; - this.token = null; - this.email = null; - this.password = null; - resolve(); - }).catch(reject); + for (const t of this._timeouts) clearTimeout(t); + for (const i of this._intervals) clearInterval(i); + this._timeouts = []; + this._intervals = []; + this.token = null; + this.email = null; + this.password = null; + this.manager.destroy().then(resolve).catch(reject); }); } diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 884076fb1..1555d4e95 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -36,7 +36,7 @@ class RESTMethods { } logout() { - return this.rest.makeRequest('post', Constants.Endpoints.logout, true); + return this.rest.makeRequest('post', Constants.Endpoints.logout, true, {}); } getGateway() {