update per issue 69 on the h&c github (#963)

* update per issue 69 on the h&c github

* clean up things that don't exist anymore
This commit is contained in:
Gus Caplan
2016-12-15 10:32:19 -06:00
committed by Amish Shah
parent 9c59b649ad
commit a20bac7258
2 changed files with 4 additions and 28 deletions

View File

@@ -16,22 +16,13 @@ class RESTMethods {
this.rest = restManager;
}
loginToken(token = this.rest.client.token) {
login(token = this.rest.client.token) {
return new Promise((resolve, reject) => {
token = token.replace(/^Bot\s*/i, '');
this.rest.client.manager.connectToWebSocket(token, resolve, reject);
});
}
loginEmailPassword(email, password) {
this.rest.client.emit('warn', 'Client launched using email and password - should use token instead');
this.rest.client.email = email;
this.rest.client.password = password;
return this.rest.makeRequest('post', Constants.Endpoints.login, false, { email, password }).then(data =>
this.loginToken(data.token)
);
}
logout() {
return this.rest.makeRequest('post', Constants.Endpoints.logout, true, {});
}