import { AuthState } from '../types' ; import { FIREBASE_PHONE_TRIGGER , FIREBASE_PHONE_VERIFY , RESET_CONFIRMATION_CODE , } from './types' ; export default { [ FIREBASE_PHONE_TRIGGER . PENDING ] : ( state ) => { state . loading = true ; } , [ FIREBASE_PHONE_TRIGGER . COMPLETED ] : ( state , { payload } ) => { state . confirmationResult = payload ; state . loading = false ; state . error = undefined ; } , [ FIREBASE_PHONE_TRIGGER . REJECTED ] : ( state , { payload } ) => { state . error = payload ; state . confirmationResult = undefined ; state . loading = false ; } , [ FIREBASE_PHONE_VERIFY . PENDING ] : ( state ) => { state . loading = true ; } , [ FIREBASE_PHONE_VERIFY . COMPLETED ] : ( state , { payload } ) => { state . user = payload . user ; state . loading = false ; } , [ FIREBASE_PHONE_VERIFY . REJECTED ] : ( state , { payload } ) => { state . error = payload ; state . confirmationResult = undefined ; state . loading = false ; } , [ RESET_CONFIRMATION_CODE ] : ( state ) => { state . confirmationResult = undefined ; state . loading = false ; } , } ;