Vulcan/packages/example-forum/lib/modules/posts/redux.js

30 lines
390 B
JavaScript
Raw Normal View History

2017-09-04 18:37:21 +09:00
/*
Redux
*/
import { addAction, addReducer } from 'meteor/vulcan:core';
addAction({
postsViewed: {
setViewed: (postId) => ({
type: 'SET_VIEWED',
postId,
}),
},
});
addReducer({
postsViewed: (state = [], action) => {
if (action.type === 'SET_VIEWED') {
return [
...state,
action.postId,
];
}
return state;
},
});