File size: 624 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import merge from 'lodash/merge';
import {
    RECEIVE_SPOTS,
    RECEIVE_SPOT
} from '../actions/spot_actions';
import { RECEIVE_USER } from '../actions/user_actions';

const spotsReducer = (state = {}, action) => {
    Object.freeze(state);

    switch (action.type) {
        case RECEIVE_SPOTS:
            return merge({}, state, action.spots);

        case RECEIVE_SPOT:
            return merge({}, state, action.payload.spots);

        case RECEIVE_USER:
            return merge({},state, action.payload.spots);
                
        default:
            return state;
    } 
};

export default spotsReducer;