import firebase , { firebaseAuth } from 'src/firebase' ; import { IOTPAuth , IPhoneNumberAuth } from './types' ; export const phoneAuthTrigger = ( payload ) : Promise < firebase . auth . ConfirmationResult > => { if ( payload . currentUser ) { return payload . currentUser . linkWithPhoneNumber ( payload . phoneNumber , payload . recaptchaVerifier ) ; } return firebaseAuth . signInWithPhoneNumber ( payload . phoneNumber , payload . recaptchaVerifier ) ; } ; export const phoneAuthVerify = ( payload , confirmationResult ) : Promise < firebase . auth . UserCredential > => confirmationResult . confirm ( payload . otp ) ;