import { HYDRATE } from 'next-redux-wrapper';

import * as actionTypes from '../constants/actionTypes';
import initialState from "./initialState";

const calendarReducer = (state = initialState.calendar, action) => 
{
	switch (action.type) 
	{
		case HYDRATE: 
		{
			return { 
				...state, 
				...action.payload.calendar, 
			};
		}

		case actionTypes.CALENDAR: 
		{
			return {
				...state, 
				...action.data, 
			};
		}

		default: {
			return state;
		}
	}
};

export default calendarReducer;