mirror of
https://github.com/vale981/Vulcan
synced 2025-03-12 05:26:38 -04:00
30 lines
390 B
JavaScript
30 lines
390 B
JavaScript
![]() |
/*
|
||
|
|
||
|
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;
|
||
|
},
|
||
|
});
|