diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/reducers/annotations.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/reducers/annotations.js Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,32 @@ +import { + REQUEST_ANNOTATIONS, + RECEIVE_ANNOTATIONS, +} from '../actions'; + +function annotations( + state = { + isFetching: false, + didInvalidate: false, + items: [], + }, + action, +) { + switch (action.type) { + case REQUEST_ANNOTATIONS: + return Object.assign({}, state, { + isFetching: true, + }); + + case RECEIVE_ANNOTATIONS: + return Object.assign({}, state, { + isFetching: false, + items: action.annotations, + lastUpdated: action.receivedAt, + }); + + default: + return state; + } +} + +export default annotations;