Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {GET_DATA_TABLE} from '../actions/actions.js';
- import {SET_ACTIVE_TABLE} from '../actions/activeTable';
- import {DATA_SELECTED} from '../actions/selectData1';
- import {Map, List, fromJS} from 'immutable';
- const defaultState = Map({
- table1: Map({recordsets: List(), recordset: List()}),
- table2: Map({recordsets: List(), recordset: List()}),
- table3: Map({recordsets: List(), recordset: List()}),
- table4: Map({recordsets: List(), recordset: List()}),
- activeTable: 'table1'
- });
- export default function(state = defaultState, action){
- switch(action.type) {
- case GET_DATA_TABLE:
- return state.set(state.get('activeTable'), fromJS(action.someData));
- case "SET_ACTIVE_TABLE":
- return state.set('activeTable', action.payload);
- case "DATA_SELECTED":
- return Object.assign(state, {
- [action.activeTable]: action.payload,
- });
- default:
- return state;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement