appReducer.js 1.08 KB
'use strict';

import InitialState from './appInitialState';

const {
	SET_PLATFORM,
	SET_CHANNEL,
	SET_HOST,
	SET_SERVICE_HOST,
	SET_SINGLE_HOST,
	SET_YOHOOD_TICKETS,
	SET_YOHOOD_TICKET,
	SET_SHOW_ANTI_FRAUD,
} = 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_SHOW_ANTI_FRAUD:
			return state.set('showAntiFraud', action.payload);
		case SET_PLATFORM:
			return state.set('platform', action.payload);
		case SET_CHANNEL:
			return state.set('channel', action.payload);
		case SET_HOST:
			return state.set('host', action.payload);
		case SET_SERVICE_HOST:
			return state.set('serviceHost', action.payload);
		case SET_SINGLE_HOST:
			return state.set('singleHost', action.payload);
		case SET_YOHOOD_TICKETS:
			return state.set('yohoodTicketsSkn', action.payload);
		case SET_YOHOOD_TICKET:
			return state.set('yohoodTicketSkn', action.payload);
    }

    return state;
}