mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-22 11:16:18 +08:00
Merge pull request #1476 from oblador/updatePhoneNumber
[auth] Support updatePhoneNumber
This commit is contained in:
7
src/index.d.ts
vendored
7
src/index.d.ts
vendored
@@ -818,6 +818,13 @@ declare module 'react-native-firebase' {
|
||||
*/
|
||||
updatePassword(password: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Updates the user's phone number.
|
||||
* See Firebase docs for more information on security & email validation.
|
||||
* This will Promise reject is the user is anonymous.
|
||||
*/
|
||||
updatePhoneNumber(credential: AuthCredential): Promise<void>;
|
||||
|
||||
/**
|
||||
* Updates a user's profile data.
|
||||
* Profile data should be an object of fields to update:
|
||||
|
||||
@@ -250,6 +250,24 @@ export default class User {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current user's phone number
|
||||
*
|
||||
* @param {AuthCredential} credential Auth credential with the _new_ phone number
|
||||
* @return {Promise}
|
||||
*/
|
||||
updatePhoneNumber(credential: AuthCredential): Promise<void> {
|
||||
return getNativeModule(this._auth)
|
||||
.updatePhoneNumber(
|
||||
credential.providerId,
|
||||
credential.token,
|
||||
credential.secret
|
||||
)
|
||||
.then(user => {
|
||||
this._auth._setUser(user);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current user's profile
|
||||
* @param {Object} updates An object containing the keys listed [here](https://firebase.google.com/docs/auth/ios/manage-users#update_a_users_profile)
|
||||
@@ -318,15 +336,6 @@ export default class User {
|
||||
);
|
||||
}
|
||||
|
||||
updatePhoneNumber() {
|
||||
throw new Error(
|
||||
INTERNALS.STRINGS.ERROR_UNSUPPORTED_CLASS_METHOD(
|
||||
'User',
|
||||
'updatePhoneNumber'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
get refreshToken(): string {
|
||||
throw new Error(
|
||||
INTERNALS.STRINGS.ERROR_UNSUPPORTED_CLASS_PROPERTY('User', 'refreshToken')
|
||||
|
||||
Reference in New Issue
Block a user