scinote-web/app/javascript/packs/shared/reducers/ActivitiesReducers.js

22 lines
452 B
JavaScript
Raw Normal View History

2017-08-02 23:27:05 +08:00
import {
GLOBAL_ACTIVITIES_DATA,
MORE_GLOBAL_ACTIVITIES
2017-08-09 21:21:02 +08:00
} from "../../app/action_types";
2017-08-02 23:27:05 +08:00
2017-08-03 17:17:09 +08:00
export function globalActivities(
state = { more: true, activities: [] },
action
) {
2017-08-02 23:27:05 +08:00
if (action.type === GLOBAL_ACTIVITIES_DATA) {
2017-08-03 17:17:09 +08:00
return {
...state,
activities: [
...state.activities,
...action.payload.global_activities.activities
],
more: action.payload.global_activities.more
};
2017-08-02 23:27:05 +08:00
}
return state;
}