clientjs/packages/dashboard-components/src/reducers/annotations.js
author ymh <ymh.work@gmail.com>
Mon, 04 Apr 2022 17:02:10 +0200
changeset 26 eb14941af2e7
parent 0 5f4fcbc80b37
permissions -rw-r--r--
Added tag 0.2.2 for changeset 7f7cdcd01dea

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;