mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
49 lines (47 loc) • 1.18 kB
JavaScript
import ActionTypes from '../actions/action-types';
/**
* annotationReducer
*/
export const annotationsReducer = (state = {}, action) => {
switch (action.type) {
case ActionTypes.REQUEST_ANNOTATION:
return {
...state,
[]: {
...state[action.targetId],
[]: {
id: action.annotationId,
isFetching: true,
},
},
};
case ActionTypes.RECEIVE_ANNOTATION:
return {
...state,
[]: {
...state[action.targetId],
[]: {
id: action.annotationId,
isFetching: false,
json: action.annotationJson,
},
},
};
case ActionTypes.RECEIVE_ANNOTATION_FAILURE:
return {
...state,
[]: {
...state[action.targetId],
[]: {
error: action.error,
id: action.annotationId,
isFetching: false,
},
},
};
case ActionTypes.IMPORT_MIRADOR_STATE:
return {};
default:
return state;
}
};