appReducer.js 725 Bytes
'use strict';

import InitialState from './appInitialState';

const {
	SET_PLATFORM,
	SET_HOST,
	SET_SINGLE_API_HOST,
	SET_LIVE_API_HOST,
} = require('../../constants/actionTypes').default;

const initialState = new InitialState;

export default function appReducer(state = initialState, action) {
    if (!(state instanceof InitialState)) return initialState.merge(state);

    switch (action.type) {
		case SET_PLATFORM:
			return state.set('platform', action.payload);
		case SET_HOST:
			return state.set('host', action.payload);
		case SET_SINGLE_API_HOST:{
			return state.set('singleApiHost', action.payload);
		}case SET_LIVE_API_HOST:{
			return state.set('liveHost', action.payload);
		}
    }

    return state;
}