41 lines
630 B
JavaScript
41 lines
630 B
JavaScript
import { HYDRATE } from 'next-redux-wrapper';
|
|
|
|
import * as actionTypes from '../constants/actionTypes';
|
|
import initialState from "./initialState";
|
|
|
|
const eventsReducer = (state = initialState.events, action) =>
|
|
{
|
|
switch (action.type)
|
|
{
|
|
case actionTypes.EVENTS:
|
|
{
|
|
return {
|
|
...state,
|
|
...action.data,
|
|
};
|
|
}
|
|
|
|
case actionTypes.EVENTS_FILTERED:
|
|
{
|
|
return {
|
|
...state,
|
|
...action.data,
|
|
};
|
|
}
|
|
|
|
case actionTypes.EVENTS_RESET:
|
|
{
|
|
return {
|
|
loaded: false,
|
|
list: undefined,
|
|
filtered: undefined,
|
|
};
|
|
}
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default eventsReducer; |