mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-23 20:10:05 +08:00
[ios,android] WIP - moving auth to promises & fixing ios <-> android discrepancies
This commit is contained in:
@@ -51,6 +51,18 @@ export default class User {
|
||||
return this._user[prop];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a user property or false if does not exist
|
||||
* @param prop
|
||||
* @returns {*}
|
||||
* @private
|
||||
*/
|
||||
_valueOrFalse(prop) {
|
||||
if (!this._user) return false;
|
||||
if (!Object.hasOwnProperty.call(this._user, prop)) return false;
|
||||
return this._user[prop];
|
||||
}
|
||||
|
||||
/**
|
||||
* PROPERTIES
|
||||
*/
|
||||
@@ -68,7 +80,7 @@ export default class User {
|
||||
}
|
||||
|
||||
get isAnonymous(): Boolean {
|
||||
return !this._valueOrNull('email') && this._valueOrNull('providerId') === 'firebase';
|
||||
return this._valueOrFalse('isAnonymous');
|
||||
}
|
||||
|
||||
get photoURL(): String|null {
|
||||
@@ -89,6 +101,7 @@ export default class User {
|
||||
*/
|
||||
|
||||
toJSON() {
|
||||
return Object.assign({}, this._user);
|
||||
return {
|
||||
uid: this.uid,
|
||||
email: this.email,
|
||||
@@ -105,7 +118,7 @@ export default class User {
|
||||
* @return {Promise}
|
||||
*/
|
||||
delete(): Promise<Object> {
|
||||
return promisify('delete', FirebaseAuth, 'auth/')();
|
||||
return FirebaseAuth.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user