const CHANGE_SELECTED_LOCATION = 'google-map-reducer/SELECT_LOCATION' ; export const changeSelectedLocation = ( payload ) => ( { type : CHANGE_SELECTED_LOCATION , payload } ) ; export interface IGoogleMapReducer { isLoading : boolean ; errorMessage : string | null ; lastUpdated : Date | null ; selectedLocation : any ; } const initialState = { isLoading : false , errorMessage : null , lastUpdated : null , selectedLocation : null } ; export default function reducer ( state = initialState , action ) { switch ( action . type ) { case CHANGE_SELECTED_LOCATION : return Object . assign ( { } , state , { selectedLocation : action . payload } ) ; default : return state ; } }