File size: 974 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import { withStorageKey } from '@automattic/state-utils';
import { ACTIVITY_LOG_FILTER_SET, ACTIVITY_LOG_FILTER_UPDATE } from 'calypso/state/action-types';
import { combineReducers, keyedReducer } from 'calypso/state/utils';
import { backupRequest, backupProgress, granularBackupDownloadRequested } from './backup/reducer';
import { restoreProgress, restoreRequest } from './restore/reducer';
export const emptyFilter = {
page: 1,
};
export const filterState = ( state = emptyFilter, { type, filter } ) => {
switch ( type ) {
case ACTIVITY_LOG_FILTER_SET:
return { ...emptyFilter, ...filter };
case ACTIVITY_LOG_FILTER_UPDATE:
return { ...state, ...filter };
default:
return state;
}
};
const combinedReducer = combineReducers( {
filter: keyedReducer( 'siteId', filterState ),
restoreProgress,
restoreRequest,
backupProgress,
backupRequest,
granularBackupDownloadRequested,
} );
export default withStorageKey( 'activityLog', combinedReducer );
|