Add API call to get a user by their email address (#4884)
* Add API call to get a user by their email address * update per review
Этот коммит содержится в:
коммит произвёл
enahum
родитель
14f1f4e9b1
Коммит
5fd11bd674
@@ -974,6 +974,15 @@ export default class Client {
|
||||
end(this.handleResponse.bind(this, 'getByUsername', success, error));
|
||||
}
|
||||
|
||||
getByEmail(email, success, error) {
|
||||
request.
|
||||
get(`${this.getUsersRoute()}/email/${email}`).
|
||||
set(this.defaultHeaders).
|
||||
type('application/json').
|
||||
accept('application/json').
|
||||
end(this.handleResponse.bind(this, 'getByEmail', success, error));
|
||||
}
|
||||
|
||||
login(loginId, password, mfaToken, success, error) {
|
||||
this.doLogin({login_id: loginId, password, token: mfaToken}, success, error);
|
||||
|
||||
|
||||
@@ -51,6 +51,21 @@ describe('Client.User', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('getByEmail', function(done) {
|
||||
TestHelper.initBasic(() => {
|
||||
TestHelper.basicClient().getByEmail(
|
||||
TestHelper.basicUser().email,
|
||||
function(data) {
|
||||
assert.equal(data.email, TestHelper.basicUser().email);
|
||||
done();
|
||||
},
|
||||
function(err) {
|
||||
done(new Error(err.message));
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('getInitialLoad', function(done) {
|
||||
TestHelper.initBasic(() => {
|
||||
TestHelper.basicClient().getInitialLoad(
|
||||
|
||||
Ссылка в новой задаче
Block a user