1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
const StateApi = require('../models/StateApi'); const ACTION_TYPES = require('../actions/TYPES'); module.exports = (state, action) => { state = StateApi.create(state); switch (action.type) { case ACTION_TYPES.API_USER_FETCHED: return state.merge({ currentUser: action.user }); default: return state; } };