insomnia/app/redux/modules/responses.js

30 lines
495 B
JavaScript
Raw Normal View History

2016-04-23 06:08:52 +00:00
const RESPONSE_UPDATE = 'responses/update';
const initialState = {};
// ~~~~~~~~ //
// REDUCERS //
// ~~~~~~~~ //
export default function (state = initialState, action) {
switch (action.type) {
case RESPONSE_UPDATE:
return Object.assign({}, state, {
[action.response.parentId]: action.response
2016-04-23 06:08:52 +00:00
});
default:
return state;
}
}
// ~~~~~~~ //
// ACTIONS //
// ~~~~~~~ //
export function update (response) {
return {type: RESPONSE_UPDATE, response};
}