import { AuthActions , AuthActionTypes } from './auth.actions' ; export interface AuthState { token : string | null ; } const initialState = { token : null , } ; export function authReducer ( state = initialState , action ) { switch ( action . type ) { case AuthActionTypes . ADD_TOKEN : return Object . assign ( { } , state , { token : action . payload } ) ; case AuthActionTypes . REMOVE_TOKEN : return Object . assign ( { } , state , { token : null } ) ; default : return state ; } }