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

28 lines
643 B
JavaScript
Raw Normal View History

2017-08-02 23:27:05 +08:00
import {
GLOBAL_ACTIVITIES_DATA,
2017-08-22 19:20:06 +08:00
DESTROY_GLOBAL_ACTIVITIES_DATA
2017-08-09 21:21:02 +08:00
} from "../../app/action_types";
2017-08-02 23:27:05 +08:00
2017-08-22 19:20:06 +08:00
const initialStateu = { more: true, activities: [] };
export function globalActivities(state = initialStateu, action) {
switch (action.type) {
case GLOBAL_ACTIVITIES_DATA:
return {
...state,
activities: [
...state.activities,
...action.payload.global_activities.activities
],
more: action.payload.global_activities.more
};
case DESTROY_GLOBAL_ACTIVITIES_DATA:
return {
...state,
...initialStateu
};
default:
return state;
2017-08-02 23:27:05 +08:00
}
}