42 lines
676 B
JavaScript
42 lines
676 B
JavaScript
import { HYDRATE } from 'next-redux-wrapper';
|
|
|
|
import * as actionTypes from '../constants/actionTypes';
|
|
import initialState from "./initialState";
|
|
|
|
const questionnaireReducer = (state = initialState.questionnaire, action) =>
|
|
{
|
|
switch (action.type)
|
|
{
|
|
/*
|
|
case HYDRATE:
|
|
{
|
|
return {
|
|
...state,
|
|
...action.payload.questionnaire,
|
|
};
|
|
}
|
|
*/
|
|
|
|
case actionTypes.QUESTIONNAIRE_UPDATE:
|
|
{
|
|
return {
|
|
...state,
|
|
...action.data.questionnaire,
|
|
};
|
|
}
|
|
|
|
case actionTypes.QUESTIONNAIRE_RESET:
|
|
{
|
|
return {
|
|
...state,
|
|
...action.data.questionnaire,
|
|
};
|
|
}
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default questionnaireReducer; |