react-native-firebase/lib/modules/auth/ConfirmationResult.js

35 lines
760 B
JavaScript
Raw Normal View History

2017-08-25 11:16:23 +00:00
/**
2017-11-17 14:22:46 +00:00
* @flow
* ConfirmationResult representation wrapper
2017-08-25 11:16:23 +00:00
*/
2017-11-17 14:22:46 +00:00
import type Auth from './';
import type User from './User';
2017-08-25 11:16:23 +00:00
export default class ConfirmationResult {
2017-11-17 14:22:46 +00:00
_auth: Auth;
2017-08-25 11:16:23 +00:00
_verificationId: string;
/**
*
* @param auth
* @param verificationId The phone number authentication operation's verification ID.
*/
2017-11-17 14:22:46 +00:00
constructor(auth: Auth, verificationId: string) {
2017-08-25 11:16:23 +00:00
this._auth = auth;
this._verificationId = verificationId;
}
/**
*
* @param verificationCode
* @return {*}
*/
2017-11-17 14:22:46 +00:00
confirm(verificationCode: string): Promise<?User> {
return this._auth._interceptUserValue(this._auth._native._confirmVerificationCode(verificationCode));
2017-08-25 11:16:23 +00:00
}
2017-11-17 14:22:46 +00:00
get verificationId(): string | null {
return this._verificationId;
2017-08-25 11:16:23 +00:00
}
}