Vulcan/packages/vulcan-posts/lib/redux.js

23 lines
375 B
JavaScript

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;
},
});