Skip to content
Snippets Groups Projects
Select Git revision
  • cfcbfafcf089f0432d004a38ef2ddf7ba53a9b2e
  • main default
  • 35-cgu
  • 34-peertube-support
  • 27-add-autoplay-to-iframe
  • 33-bug-on-youtube-embed-urls
  • RC-Rekall-v1.1-fix_lpo
  • tuleap-140-go-back-to-my-capsules-page-when-i-m-on-capsule-preview-page
  • RC-Rekall-v1.2-fix10
  • RC-Rekall-v1.2-fix9
  • RC-Rekall-v1.2-fix8
  • RC-Rekall-v1.2-fix7
  • RC-Rekall-v1.2-fix6
  • RC-Rekall-v1.2-fix5
  • RC-Rekall-v1.2-fix4
  • RC-Rekall-v1.2-fix3
  • RC-Rekall-v1.2-fix2
  • RC-Rekall-v1.2-fix1
  • RC-Rekall-v1.1-fix-3
  • RC-Rekall-v1.1-fix-2
  • RC-Rekall-v1.1-fix-1
  • RC-Rekall-v1.1-delivered
  • preprod20220209-1535
23 results

index.html

Blame
  • manifests.js 1.33 KiB
    import manifesto from 'manifesto.js';
    import ActionTypes from '../actions/action-types';
    
    /**
     * manifestsReducer
     */
    export const manifestsReducer = (state = {}, action) => {
      switch (action.type) {
        case ActionTypes.REQUEST_MANIFEST:
          return {
            ...state,
            [action.manifestId]: {
              ...state[action.manifestId],
              ...action.properties,
              id: action.manifestId,
            },
          };
        case ActionTypes.RECEIVE_MANIFEST:
          return {
            ...state,
            [action.manifestId]: {
              ...state[action.manifestId],
              id: action.manifestId,
              manifestation: manifesto.create(action.manifestJson),
              isFetching: false,
              error: null, // Explicitly set the error to null in case this is a re-fetch
            },
          };
        case ActionTypes.RECEIVE_MANIFEST_FAILURE:
          return {
            ...state,
            [action.manifestId]: {
              ...state[action.manifestId],
              id: action.manifestId,
              error: action.error,
              isFetching: false,
            },
          };
        case ActionTypes.REMOVE_MANIFEST:
          return Object.keys(state).reduce((object, key) => {
            if (key !== action.manifestId) {
              object[key] = state[key]; // eslint-disable-line no-param-reassign
            }
            return object;
          }, {});
        default: return state;
      }
    };