| 12345678910111213141516171819202122232425262728293031323334353637 |
- import { createReducerObject } from 'create-reducer-object';
- import {
- ANNOYED,
- ANNOY_RESPONDED
- } from 'constants/actions';
- const initialState = {
- loading: false,
- error: false
- };
- function onAnnoy(state) {
- if (state.loading) {
- return {};
- }
- return {
- loading: true,
- error: false
- };
- }
- function onAnnoyed(state, { err }) {
- return {
- loading: false,
- error: Boolean(err)
- };
- }
- const reducerMap = {
- [ANNOYED]: onAnnoy,
- [ANNOY_RESPONDED]: onAnnoyed
- };
- export const annoy = createReducerObject(reducerMap, initialState);
|