clientjs/packages/dashboard-components/src/reducers/annotations.js
changeset 0 5f4fcbc80b37
equal deleted inserted replaced
-1:000000000000 0:5f4fcbc80b37
       
     1 import {
       
     2   REQUEST_ANNOTATIONS,
       
     3   RECEIVE_ANNOTATIONS,
       
     4 } from '../actions';
       
     5 
       
     6 function annotations(
       
     7   state = {
       
     8     isFetching: false,
       
     9     didInvalidate: false,
       
    10     items: [],
       
    11   },
       
    12   action,
       
    13 ) {
       
    14   switch (action.type) {
       
    15     case REQUEST_ANNOTATIONS:
       
    16       return Object.assign({}, state, {
       
    17         isFetching: true,
       
    18       });
       
    19 
       
    20     case RECEIVE_ANNOTATIONS:
       
    21       return Object.assign({}, state, {
       
    22         isFetching: false,
       
    23         items: action.annotations,
       
    24         lastUpdated: action.receivedAt,
       
    25       });
       
    26 
       
    27     default:
       
    28       return state;
       
    29   }
       
    30 }
       
    31 
       
    32 export default annotations;