quintodrome/ui/src/reducers/activityReducer.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
616 B
JavaScript
Raw Normal View History

2020-11-13 14:40:33 -09:00
import { EVENT_SCAN_STATUS, EVENT_SERVER_START } from '../actions'
const defaultState = {
scanStatus: { scanning: false, folderCount: 0, count: 0 },
}
export const activityReducer = (
previousState = {
2020-11-13 14:40:33 -09:00
scanStatus: defaultState,
},
payload
) => {
const { type, data } = payload
switch (type) {
case EVENT_SCAN_STATUS:
return { ...previousState, scanStatus: data }
2020-11-13 14:40:33 -09:00
case EVENT_SERVER_START:
return {
...previousState,
serverStart: {
startTime: data.startTime && Date.parse(data.startTime),
},
}
default:
return previousState
}
}