screenReducer.js 991 Bytes
'use strict';

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

const {
	SET_DATASOURCE,
	SET_SELECTLIST,
	CANCEL_SELECT,
} = require('../../constants/actionTypes').default;

const initialState = new InitialState;

export default function screenReducer(state=initialState, action) {
    switch(action.type){
        case SET_DATASOURCE:
        {
            return state.set('categoryFilterList',Immutable.fromJS(action.payload.categoryFilterList))
			.set('origincategoryFilterList',Immutable.fromJS(action.payload.categoryFilterList))
			.set('filterCategoryDetailFilterList',Immutable.fromJS(action.payload.filterCategoryDetailFilterList))
			.set('dataSourceType', action.payload.dataSourceType);
        }
		case SET_SELECTLIST:
		{
			return state.set('categoryFilterList',Immutable.fromJS(action.payload));
		}
		case CANCEL_SELECT:
		{
			return state.set('categoryFilterList',Immutable.fromJS(action.payload));
		}
	}
    return state;
}