Changeset View
Changeset View
Standalone View
Standalone View
web/redux/community-picker-reducer.js
// @flow | // @flow | ||||
import { | import { | ||||
updateCalendarCommunityFilter, | updateCalendarCommunityFilter, | ||||
clearCalendarCommunityFilter, | clearCalendarCommunityFilter, | ||||
updateChatCommunityFilter, | |||||
clearChatCommunityFilter, | |||||
} from 'lib/actions/community-actions.js'; | } from 'lib/actions/community-actions.js'; | ||||
import type { Action, CommunityPickerStore } from './redux-setup'; | import type { Action, CommunityPickerStore } from './redux-setup'; | ||||
export function reduceCommunityPickerStore( | export function reduceCommunityPickerStore( | ||||
communityPickerStore: CommunityPickerStore, | communityPickerStore: CommunityPickerStore, | ||||
action: Action, | action: Action, | ||||
): CommunityPickerStore { | ): CommunityPickerStore { | ||||
if (action.type === updateCalendarCommunityFilter) { | if (action.type === updateCalendarCommunityFilter) { | ||||
return { | return { | ||||
...communityPickerStore, | ...communityPickerStore, | ||||
calendar: action.payload, | calendar: action.payload, | ||||
}; | }; | ||||
} else if (action.type === clearCalendarCommunityFilter) { | } else if (action.type === clearCalendarCommunityFilter) { | ||||
return { | return { | ||||
...communityPickerStore, | ...communityPickerStore, | ||||
calendar: null, | calendar: null, | ||||
}; | }; | ||||
} else if (action.type === updateChatCommunityFilter) { | |||||
return { | |||||
...communityPickerStore, | |||||
chat: action.payload, | |||||
}; | |||||
} else if (action.type === clearChatCommunityFilter) { | |||||
return { | |||||
...communityPickerStore, | |||||
chat: null, | |||||
}; | |||||
} | } | ||||
return communityPickerStore; | return communityPickerStore; | ||||
} | } |