mirror of
https://github.com/Nezumi-2711/javascript-training.git
synced 2026-09-23 04:09:58 +00:00
Add and edit comment in userService
This commit is contained in:
@@ -23,7 +23,7 @@ export default class UserService extends CommonService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user by email
|
* Get user id by email
|
||||||
* @param {string} email Email need to be check
|
* @param {string} email Email need to be check
|
||||||
* @returns {Promise || number} Return id user when exist, otherwise will undefined
|
* @returns {Promise || number} Return id user when exist, otherwise will undefined
|
||||||
*/
|
*/
|
||||||
@@ -52,9 +52,17 @@ export default class UserService extends CommonService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user data from email
|
||||||
|
* @param {string} email Email user
|
||||||
|
* @returns {Object || null} Return new User Object if find, otherwise return null.
|
||||||
|
*/
|
||||||
async getUserByEmail(email) {
|
async getUserByEmail(email) {
|
||||||
const id = await this.getUserIdByEmail(email);
|
const id = await this.getUserIdByEmail(email);
|
||||||
const user = await FirebaseService.getDataFromId(id, this.path);
|
if (id) {
|
||||||
return new User(user);
|
const user = await FirebaseService.getDataFromId(id, this.path);
|
||||||
|
return new User(user);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user