import { AuthAction , authActions } from './auth.actions' ; import { initialState , State } from './auth.state' ; export function reducer ( state = initialState , action ) { return authActions . match ( { accountLogin : ( ) => ( { ... state , isProcessing : true , error : undefined } ) , accountLoginSuccess : ( ) => ( { ... state , isProcessing : false , error : undefined } ) , accountLoginFail : ( error ) => ( { ... state , isProcessing : false , error } ) , accountLogout : ( ) => ( { ... state , isProcessing : false , error : undefined } ) , default : ( ) => state } ) ( action ) ; }