Select Git revision
NoteReducer.js
Forked from
KSZK / DevTeam / kszkepzes / old / kszkepzes-frontend
90 commits behind the upstream repository.
-
Rafael László authoredRafael László authored
NoteReducer.js 674 B
import {
ADD_EVENT_NOTE,
CLEAR_WRITE,
GET_NOTES_BY_EVENT,
WRITE_NOTE,
} from '../actions/types';
const INITIAL_STATE = { eventNotes: [], actualNote: {} };
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case GET_NOTES_BY_EVENT:
return { ...state, eventNotes: action.payload };
case WRITE_NOTE:
return {
...state,
actualNote: { ...state.actualNote, note: action.payload },
};
case ADD_EVENT_NOTE:
return { ...state, eventNotes: [...state.eventNotes, action.payload] };
case CLEAR_WRITE:
return { ...state, actualNote: { note: '' } };
default:
return state;
}
};