import { RememberMeActions , RememberMeActionTypes } from "./actions" ; /**
 * Remember me state
 *
 * The refresh state needs to be persisted across sessions to properly handle
 * token-based authentication as the refresh token is persisted as a secure
 * HTTP-only cookie, and thus cannot be read from the application.
 *
 * - The `active` flag determines the checked state of the remember me checkbox
 *   so the user doesn't have to re-check it everytime the refresh token expires
 *   and he has to authenticate again.
 *
 * - The `failed` flag denotes whether re-authentication failed
 */ export interface RememberMeState { active : boolean ; failed ? : true ; } param state param action export function remember ( state = { active : false } , action ) { switch ( action . type ) { case RememberMeActionTypes . SET : return { ... state , active : action . active } ; case RememberMeActionTypes . SET_FAILED : return { ... state , failed : true } ; default : return state ; } }