Example #1
0
File: posts.js Project: amuzr/immo
export default function (state = INITIAL_STATE, action) {
  switch (action.type) {
    case resolve(FETCH_POST): {
      return state;
    }
    
    case resolve(FETCH_PAGE): {
      return state;
    }

    case resolve(FETCH_POSTS): {
      const data = action.data;
      return { ...state, all: data };
    }

    case resolve(FETCH_POSTS_CATEGORY): {
      return state;
    }

    case resolve(FETCH_POSTS_TAG): {
      return state;
    }

    default:
      return state;
  }
}
Example #2
0
export function reducer (state = initialState, action) {
  switch (action.type) {
    case resolve(FETCH_CURRENT_USER):
      return { ...state, currentUser: action.payload.user }

    default:
      return state
  }
}
export default function (state = INITIAL_STATE, action) {
    switch (action.type) {
      case resolve(FETCH_PROJECTS): {
        const data = action.payload.data;
        return { ...state, all: data };
      }

      default:
        return state;
  }
}
export function reducer (state = initialState, action) {
  switch (action.type) {
    case resolve(FETCH_CURRENT_USER):
      return { ...state, sightings: action.payload.user.birds }

    case CREATE_USER_SIGHTING:
      return {
        ...state,
        sightings: unionBy(state.sightings, [action.payload.bird], 'id')
      }

    case DELETE_USER_SIGHTING:
      return {
        ...state,
        sightings: reject(state.sightings, {id: action.payload.bird.id})
      }

    default: return state
  }
}