screenSubReducer.js 916 Bytes
'use strict';

import InitialState from './screenSubInitialState';
import Immutable, {Map} from 'immutable';

const {
	SET_DATASOURCE_SUB,
	SET_SELECT_ITEM,
} = require('../../constants/actionTypes').default;

const initialState = new InitialState;

export default function screenSubReducer(state=initialState, action) {
    switch(action.type){
        case SET_DATASOURCE_SUB:
        {
			return state.setIn(['filterSub', 'key'], action.payload.key)
				.setIn(['filterSub', 'list'], Immutable.fromJS(action.payload.list))
				.setIn(['filterSub', 'keyList'], Immutable.fromJS(action.payload.keyList))
				.setIn(['filterSub', 'allObj'], Immutable.fromJS(action.payload.allObj))
				.setIn(['filterSub', 'specialList'], Immutable.fromJS(action.payload.specialList));

        }
		case SET_SELECT_ITEM:
		{
			return state.setIn(['filterSub', 'list'], Immutable.fromJS(action.payload));
		}
	}
    return state;
}