UNPKG

trc-client-core

Version:
24 lines (20 loc) 693 B
import {Map, fromJS} from 'immutable'; import { LEARNING_EVENT_REQUEST_CERTIFICATION, LEARNING_EVENT_REQUEST_COMPLETION, } from 'trc-client-core/src/constants/ActionTypes'; const initialState = fromJS({ certification: [], completion: {} }); export default function LearningEventReducer(state = initialState, action) { switch (action.type) { case LEARNING_EVENT_REQUEST_CERTIFICATION: return state.set('certification', fromJS(action.payload).map(ii => ii.flatten(1))); case LEARNING_EVENT_REQUEST_COMPLETION: return state .setIn(['completion'], action.payload); default: return state; } }