Skip to content

Instantly share code, notes, and snippets.

@kieran
Created November 26, 2016 20:45
Show Gist options
  • Save kieran/f9c9fda62d22d9f6aaaa8672c21ef80d to your computer and use it in GitHub Desktop.
Save kieran/f9c9fda62d22d9f6aaaa8672c21ef80d to your computer and use it in GitHub Desktop.
module.exports =
eventsLoading: (state=false, action)->
params = _.omit action, 'type'
switch action.type
when 'GET_EVENTS'
true
when 'RECEIVE_EVENTS'
false
else
state
events: (state=[], action)->
params = _.omit action, 'type'
switch action.type
when 'RECEIVE_EVENTS'
params.events
else
state
selectedEvent: (state=null, action)->
params = _.omit action, 'type'
switch action.type
when 'GET_EVENTS'
null
when 'RECEIVE_EVENTS'
params.events?[0]
when 'SELECT_EVENT'
params.event
else
state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment