activitypub-academy/app/javascript/mastodon/reducers/activity_log.js
Sebastian Jambor 26f3b35cc7 move event source to top level
this way, activities are always logged while the app is open, and the
activity log survives local navigations
2023-04-17 17:54:15 +02:00

17 lines
466 B
JavaScript

import { Map as ImmutableMap } from 'immutable';
import { ACTIVITY_LOG_ADD, ACTIVITY_LOG_RESET } from '../actions/activity_log';
const initialState = ImmutableMap({
logs: [],
});
export default function activity_log(state = initialState, action) {
switch (action.type) {
case ACTIVITY_LOG_ADD:
return state.set('logs', [...state.get('logs'), action.value]);
case ACTIVITY_LOG_RESET:
return state.set('logs', []);
default:
return state;
}
}