Commit a7e8c158 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '214-activity-indicator' into 'master'

Activity indicator

Closes #214

See merge request genesys-pgr/genesys-ui!224
parents 5e430f38 8942ff03
// actions
import {createApiCaller} from 'actions/ApiCall';
// Constants // Constants
import {DASHBOARD_APPEND_ACCESSIONS, DASHBOARD_RECEIVE_ACCESSIONS} from 'accessions/constants'; import {DASHBOARD_APPEND_ACCESSIONS} from 'accessions/constants';
// Model // Model
import FilteredPage, {IPageRequest} from 'model/FilteredPage'; import {IPageRequest} from 'model/FilteredPage';
import Accession from 'model/accession/Accession';
import AccessionFilter from 'model/accession/AccessionFilter'; import AccessionFilter from 'model/accession/AccessionFilter';
// Service // Service
import AccessionService from 'service/genesys/AccessionService'; import AccessionService from 'service/genesys/AccessionService';
const apiListAccessions = createApiCaller(AccessionService.list, DASHBOARD_APPEND_ACCESSIONS);
const receiveAccessions = (paged: FilteredPage<Accession>, error = null) => ({
type: DASHBOARD_RECEIVE_ACCESSIONS,
payload: { paged, error },
});
const appendAccessions = (paged: FilteredPage<Accession>, error = null) => ({
type: DASHBOARD_APPEND_ACCESSIONS,
payload: { paged, error },
});
// Load accession page without redirect // Load accession page without redirect
export const loadAccessionsPageAction = (page: IPageRequest, filterCode: string | AccessionFilter) => (dispatch, getState) => { export const loadAccessionsPageAction = (page: IPageRequest, filterCode: string | AccessionFilter) => (dispatch, getState) => {
return AccessionService.list(filterCode, page) return dispatch(apiListAccessions(filterCode, page));
.then((paged) => {
if (paged.number === 0) {
dispatch(receiveAccessions(paged));
} else {
dispatch(appendAccessions(paged));
}
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessions(null, error.response));
});
}; };
...@@ -6,46 +6,44 @@ import navigateTo from 'actions/navigation'; ...@@ -6,46 +6,44 @@ import navigateTo from 'actions/navigation';
import FilteredPage, { IPageRequest } from 'model/FilteredPage'; import FilteredPage, { IPageRequest } from 'model/FilteredPage';
import Accession from 'model/accession/Accession'; import Accession from 'model/accession/Accession';
import AccessionFilter from 'model/accession/AccessionFilter'; import AccessionFilter from 'model/accession/AccessionFilter';
import AccessionDetails from 'model/accession/AccessionDetails';
import AccessionMapInfo from 'model/accession/AccessionMapInfo'; import AccessionMapInfo from 'model/accession/AccessionMapInfo';
import AccessionAuditLog from 'model/accession/AccessionAuditLog';
import MapLayer from 'model/genesys/MapTileLayer'; import MapLayer from 'model/genesys/MapTileLayer';
import { RECEIVE_ACCESSIONS, RECEIVE_ACCESSION, RECEIVE_ACCESSION_OVERVIEW, APPEND_ACCESSIONS, RECEIVE_ACCESSION_MAPINFO, RECEIVE_ACCESSION_AUDIT_LOG, RECEIVE_TILE_LAYER } from 'accessions/constants'; import {
RECEIVE_ACCESSION,
RECEIVE_ACCESSION_OVERVIEW,
RECEIVE_ACCESSION_MAPINFO,
RECEIVE_ACCESSION_AUDIT_LOG,
RECEIVE_TILE_LAYER,
APPEND_ACCESSIONS,
} from 'accessions/constants';
import AccessionService from 'service/genesys/AccessionService'; import AccessionService from 'service/genesys/AccessionService';
import ClimateService from 'service/genesys/ClimateService';
import { showSnackbar } from 'actions/snackbar'; import { showSnackbar } from 'actions/snackbar';
import Page from 'model/Page'; import Page from 'model/Page';
import TileClimate from 'model/genesys/TileClimate'; import TileClimate from 'model/genesys/TileClimate';
import {createApiCaller, createPureApiCaller} from 'actions/ApiCall';
import ApiCall from 'model/ApiCall';
const receiveAccessions = (paged: FilteredPage<Accession>, error = null) => ({ const receiveAccessionMapInfo = (apiCall: ApiCall<any>) => ({
type: RECEIVE_ACCESSIONS, type: RECEIVE_ACCESSION_MAPINFO,
payload: { paged, error }, payload: { apiCall },
}); });
const appendAccessions = (paged: FilteredPage<Accession>, error = null) => ({ // Wrapped API calls
type: APPEND_ACCESSIONS, const apiListAccessions = createApiCaller(AccessionService.list, APPEND_ACCESSIONS);
payload: { paged, error }, const apiAccessionsOverview = createApiCaller(AccessionService.listOverview, RECEIVE_ACCESSION_OVERVIEW);
}); const apiAccessionsMapInfo = createApiCaller(AccessionService.mapInfo, RECEIVE_ACCESSION_MAPINFO);
const receiveAccessionOverview = (overview: any, error = null) => ({ const apiGeoJson = createPureApiCaller(AccessionService.geoJson);
type: RECEIVE_ACCESSION_OVERVIEW, const apiClimateInfo = createPureApiCaller(ClimateService.getCurrentClimate);
payload: { overview, error },
});
const receiveAccessionMapInfo = (mapInfo: AccessionMapInfo, error = null) => ({ const apiListAccessionByUuid = createPureApiCaller(AccessionService.listAllByUuid);
type: RECEIVE_ACCESSION_MAPINFO, const apiAccessionByUuid = createApiCaller(AccessionService.getDetailsByUuid, RECEIVE_ACCESSION);
payload: { mapInfo, error }, const apiAccessionByDoi = createApiCaller(AccessionService.getDetailsByDoi, RECEIVE_ACCESSION);
});
const receiveAccession = (accession: AccessionDetails, error = null) => ({
type: RECEIVE_ACCESSION,
payload: { accession, error },
});
const receiveAccessionAuditLog = (auditLog: AccessionAuditLog, error = null) => ({ const apiAccessionAuditByUuid = createApiCaller(AccessionService.getAccessionAuditLogByUUID, RECEIVE_ACCESSION_AUDIT_LOG);
type: RECEIVE_ACCESSION_AUDIT_LOG, const apiAccessionAuditByDoi = createApiCaller(AccessionService.getAccessionAuditLogByDoi, RECEIVE_ACCESSION_AUDIT_LOG);
payload: { auditLog, error },
});
export const updateRoute = (paged: FilteredPage<Accession>, path: string = '/a') => (dispatch) => { export const updateRoute = (paged: FilteredPage<Accession>, path: string = '/a') => (dispatch) => {
...@@ -61,150 +59,85 @@ export const updateRouteWithFilterCode = (filterCode: string, path: string = '/a ...@@ -61,150 +59,85 @@ export const updateRouteWithFilterCode = (filterCode: string, path: string = '/a
dispatch(navigateTo(filterCode ? `${path}/${filterCode}${postfix}` : path, qs)); dispatch(navigateTo(filterCode ? `${path}/${filterCode}${postfix}` : path, qs));
}; };
export const applyFilters = (filters: string | AccessionFilter, page: IPageRequest = { page: 0 }) => (dispatch) => { export const applyFilters = (filters: string | AccessionFilter, page: IPageRequest = { page: 0 }) => (dispatch, getState) => {
console.log('Applying new filter', filters); console.log('Applying new filter', filters);
dispatch(showSnackbar('Applying filters...')); dispatch(showSnackbar('Applying filters...'));
return AccessionService.list(filters, page) return dispatch(apiListAccessions(filters, page))
.then((paged) => { .then((paged) => {
dispatch(receiveAccessions(paged));
dispatch(updateRoute(paged)); dispatch(updateRoute(paged));
dispatch(showSnackbar(`Filters applied.`)); dispatch(showSnackbar(`Filters applied.`));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessions(null, error));
dispatch(showSnackbar(`API error: ${error.statusText}`));
}); });
}; };
export const listAccessionsByUuid = (uuidList: string[]) => (dispatch) => {
return dispatch(apiListAccessionByUuid(uuidList));
};
export const loadMoreAccessions = (paged?: FilteredPage<Accession>) => (dispatch) => { export const loadMoreAccessions = (paged?: FilteredPage<Accession>) => (dispatch) => {
console.log('Load more accessions', paged); console.log('Load more accessions', paged);
return AccessionService.list(paged ? paged.filterCode : '', Page.nextPage(paged)) return dispatch(apiListAccessions(paged ? paged.filterCode : '', Page.nextPage(paged)))
.then((paged) => { .then((paged) => dispatch(updateRoute(paged)));
if (paged.number === 0) {
dispatch(receiveAccessions(paged));
} else {
dispatch(appendAccessions(paged));
}
dispatch(updateRoute(paged));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessions(null, error));
});
}; };
export const applyOverviewFilters = (filters: string | AccessionFilter, page: IPageRequest = { page: 0 }) => (dispatch) => { export const applyOverviewFilters = (filters: string | AccessionFilter, page: IPageRequest = { page: 0 }) => (dispatch) => {
console.log('Applying new filter', filters); console.log('Applying new filter', filters);
return AccessionService.listOverview(filters) return dispatch(apiAccessionsOverview(filters))
.then((overview) => { .then((overview) => {
dispatch(receiveAccessionOverview(overview));
dispatch(updateRouteWithFilterCode(overview.filterCode, '/a/overview')); dispatch(updateRouteWithFilterCode(overview.filterCode, '/a/overview'));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessionOverview(null, error));
}); });
}; };
export const loadAccessionsOverviewPage = (filterCode: string) => (dispatch) => { export const loadAccessionsOverviewPage = (filterCode: string) => (dispatch) => {
return AccessionService.listOverview(filterCode) return dispatch(apiAccessionsOverview(filterCode));
.then((paged) => { };
dispatch(receiveAccessionOverview(paged));
}).catch((error) => { export const geoJsonRequest = (filter, limit) => (dispatch) => {
console.log(`API error`, error); return dispatch(apiGeoJson(filter, limit));
dispatch(receiveAccessionOverview(null, error)); };
});
export const currentClimateRequest = (lat, lng) => (dispatch) => {
return dispatch(apiClimateInfo(lat, lng));
}; };
export const loadAccessionsMapInfo = (filters: string | AccessionFilter, viewPort?: {center: number[], zoom: number}) => (dispatch) => { export const loadAccessionsMapInfo = (filters: string | AccessionFilter, viewPort?: {center: number[], zoom: number}) => (dispatch) => {
return AccessionService.mapInfo(filters) return dispatch(apiAccessionsMapInfo(filters))
.then((mapInfo: AccessionMapInfo) => { .then((mapInfo: AccessionMapInfo) => {
if (!(mapInfo.bounds[0][0] && mapInfo.bounds[0][1] && mapInfo.bounds[1][0] && mapInfo.bounds[1][1])) { if (!(mapInfo.bounds[0][0] && mapInfo.bounds[0][1] && mapInfo.bounds[1][0] && mapInfo.bounds[1][1])) {
mapInfo.bounds = [[-170, 80], [170, -80]]; mapInfo.bounds = [[-170, 80], [170, -80]];
console.log('One of map bounds is null, setting to default.'); console.log('One of map bounds is null, setting to default.');
dispatch(receiveAccessionMapInfo(ApiCall.success(mapInfo)));
} }
dispatch(receiveAccessionMapInfo(mapInfo));
if (viewPort && viewPort.zoom && viewPort.center && viewPort.center.length === 2) { if (viewPort && viewPort.zoom && viewPort.center && viewPort.center.length === 2) {
console.log(`viewPort @..,z${viewPort.zoom}`, viewPort); console.log(`viewPort @..,z${viewPort.zoom}`, viewPort);
dispatch(updateRouteWithFilterCode(mapInfo.filterCode, '/a/map', null, viewPort && viewPort.center && `/@${viewPort.center[0]},${viewPort.center[1]},${viewPort.zoom}z`)); dispatch(updateRouteWithFilterCode(mapInfo.filterCode, '/a/map', null, viewPort && viewPort.center && `/@${viewPort.center[0]},${viewPort.center[1]},${viewPort.zoom}z`));
} else { } else {
dispatch(updateRouteWithFilterCode(mapInfo.filterCode, '/a/map')); dispatch(updateRouteWithFilterCode(mapInfo.filterCode, '/a/map'));
} }
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessionMapInfo(null, error));
}); });
}; };
// export const loadAccessionsPage = (page: IPageRequest) => (dispatch, getState) => {
// const filterCode = getState().accessions.public.paged.filterCode;
// return AccessionService.list(filterCode, page)
// .then((paged) => {
// if (paged.number === 0) {
// dispatch(receiveAccessions(paged));
// } else {
// dispatch(appendAccessions(paged));
// }
// dispatch(updateRoute(paged));
// }).catch((error) => {
// console.log(`API error`, error);
// dispatch(receiveAccessions(null, error));
// });
// };
// // Load accession page without redirect
// export const loadAccessionsPageAction = (page: IPageRequest, filterCode: string | AccessionFilter) => (dispatch, getState) => {
// return AccessionService.list(filterCode, page)
// .then((paged) => {
// if (paged.number === 0) {
// dispatch(receiveAccessions(paged));
// } else {
// dispatch(appendAccessions(paged));
// }
// }).catch((error) => {
// console.log(`API error`, error);
// dispatch(receiveAccessions(null, error.response));
// });
// };
export const loadAccession = ({ uuid, doi }: { uuid?: string, doi?: string }) => (dispatch) => { export const loadAccession = ({ uuid, doi }: { uuid?: string, doi?: string }) => (dispatch) => {
const loader = doi ? AccessionService.getDetailsByDoi : AccessionService.getDetailsByUuid; const loader = doi ? apiAccessionByDoi : apiAccessionByUuid;
const lookup = doi ? doi : uuid; const lookup = doi ? doi : uuid;
return loader(lookup) return dispatch(loader(lookup));
.then((accession) => {
dispatch(receiveAccession(accession));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccession(null, error));
});
}; };
export const loadAccessionAuditLog = ({uuid, doi}: {uuid?: string, doi?: string}) => (dispatch) => { export const loadAccessionAuditLog = ({uuid, doi}: {uuid?: string, doi?: string}) => (dispatch) => {
const loader = doi ? AccessionService.getAccessionAuditLogByDoi : AccessionService.getAccessionAuditLogByUUID; const loader = doi ? apiAccessionAuditByDoi : apiAccessionAuditByUuid;
const lookup = doi ? doi : uuid; const lookup = doi ? doi : uuid;
return loader(lookup) return dispatch(loader(lookup))
.then((auditLog) => { .then((auditLog) => {
if (_.isEmpty(auditLog.auditAccession) && _.isEmpty(auditLog.auditAccessionCollect) && _.isEmpty(auditLog.auditAccessionGeo) && _.isEmpty(auditLog.auditAccessionId)) { if (_.isEmpty(auditLog.auditAccession) && _.isEmpty(auditLog.auditAccessionCollect) && _.isEmpty(auditLog.auditAccessionGeo) && _.isEmpty(auditLog.auditAccessionId)) {
return dispatch(showSnackbar('common:label.noChanges')); return dispatch(showSnackbar('common:label.noChanges'));
} }
dispatch(receiveAccessionAuditLog(auditLog));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccession(null, error));
}); });
}; };
export const overviewAccessions = (filterCode: string) => (dispatch) => { export const overviewAccessions = (filterCode: string) => (dispatch) => {
return AccessionService.listOverview(filterCode) return dispatch(apiAccessionsOverview(filterCode));
.then((overview) => {
dispatch(receiveAccessionOverview(overview));
}).catch((error) => {
console.log(`API error`, error);
dispatch(receiveAccessionOverview(null, error));
});
}; };
// TileLayers // TileLayers
...@@ -278,3 +211,4 @@ export const applyClimateFilters = (climate: TileClimate, extraFilters?: any) => ...@@ -278,3 +211,4 @@ export const applyClimateFilters = (climate: TileClimate, extraFilters?: any) =>
dispatch(applyFilters(filter)); dispatch(applyFilters(filter));
}; };
export const RECEIVE_ACCESSIONS = 'accessions/RECEIVE_ACCESSIONS';
export const APPEND_ACCESSIONS = 'accessions/APPEND_ACCESSIONS'; export const APPEND_ACCESSIONS = 'accessions/APPEND_ACCESSIONS';
export const RECEIVE_ACCESSION_OVERVIEW = 'accessions/RECEIVE_ACCESSION_OVERVIEW'; export const RECEIVE_ACCESSION_OVERVIEW = 'accessions/RECEIVE_ACCESSION_OVERVIEW';
export const RECEIVE_TILE_LAYER = 'accessions/RECEIVE_TILE_LAYER'; export const RECEIVE_TILE_LAYER = 'accessions/RECEIVE_TILE_LAYER';
...@@ -10,6 +9,5 @@ export const ACCESSION_MAP_FILTERFORM = 'Form/Accession/ACCESSION_MAP_FILTERFORM ...@@ -10,6 +9,5 @@ export const ACCESSION_MAP_FILTERFORM = 'Form/Accession/ACCESSION_MAP_FILTERFORM
export const ACCESSION_FORM = 'Form/Accession/ACCESSION_FORM'; export const ACCESSION_FORM = 'Form/Accession/ACCESSION_FORM';
// Dashboard // Dashboard
export const DASHBOARD_RECEIVE_ACCESSIONS = 'accessions/dashboard/RECEIVE_ACCESSIONS';
export const DASHBOARD_APPEND_ACCESSIONS = 'accessions/dashboard/APPEND_ACCESSIONS'; export const DASHBOARD_APPEND_ACCESSIONS = 'accessions/dashboard/APPEND_ACCESSIONS';
export const DASHBOARD_RECEIVE_ACCESSION = 'accessions/dashboard/RECEIVE_ACCESSION'; export const DASHBOARD_RECEIVE_ACCESSION = 'accessions/dashboard/RECEIVE_ACCESSION';
import update from 'immutability-helper'; import update from 'immutability-helper';
import { IReducerAction } from 'model/common.model'; import { IReducerAction } from 'model/common.model';
import {DASHBOARD_RECEIVE_ACCESSIONS, DASHBOARD_RECEIVE_ACCESSION, DASHBOARD_APPEND_ACCESSIONS} from 'accessions/constants'; import {DASHBOARD_RECEIVE_ACCESSION, DASHBOARD_APPEND_ACCESSIONS} from 'accessions/constants';
import FilteredPage from 'model/FilteredPage'; import FilteredPage from 'model/FilteredPage';
import Accession from 'model/accession/Accession'; import Accession from 'model/accession/Accession';
import ApiCall from 'model/ApiCall';
const INITIAL_STATE: { const INITIAL_STATE: {
accession: Accession; accession: ApiCall<Accession>;
accessionError: any; paged: ApiCall<FilteredPage<Accession>>;
paged: FilteredPage<Accession>;
pagedError: any;
} = { } = {
accession: null, accession: null,
accessionError: null,
paged: null, paged: null,
pagedError: null,
}; };
function dashboardAccessions(state = INITIAL_STATE, action: IReducerAction) { function dashboardAccessions(state = INITIAL_STATE, action: IReducerAction) {
...@@ -23,53 +20,40 @@ function dashboardAccessions(state = INITIAL_STATE, action: IReducerAction) { ...@@ -23,53 +20,40 @@ function dashboardAccessions(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) { switch (action.type) {
case DASHBOARD_RECEIVE_ACCESSION: { case DASHBOARD_RECEIVE_ACCESSION: {
const {accession, error} = action.payload; const {apiCall} = action.payload;
const receivedIndex = state.paged ? state.paged.content.findIndex((item) => item.uuid === accession.uuid) : -1; const receivedIndex = state.paged ? state.paged.data.content.findIndex((item) => item.uuid === apiCall.data.uuid) : -1;
if (receivedIndex !== -1) { if (receivedIndex !== -1) {
return update(state, { return update(state, {
accession: { $set: accession }, accession: {$set: apiCall},
paged: { paged: {
content: { data: {
[receivedIndex]: {$set: accession}, content: {
[receivedIndex]: {$set: apiCall.data},
},
}, },
}, },
accessionError: {$set: error},
}); });
} else { } else {
return update(state, { return update(state, {
accession: { $set: accession}, accession: {$set: apiCall},
paged: {$set: null}, paged: {$set: null},
accessionError: {$set: error},
}); });
} }
} }
case DASHBOARD_RECEIVE_ACCESSIONS: {
const { paged, error } = action.payload;
return update(state, {
paged: { $set: paged },
pagedError: { $set: error },
overview: {$set: null},
mapInfo: { $set: null },
});
}
case DASHBOARD_APPEND_ACCESSIONS: { case DASHBOARD_APPEND_ACCESSIONS: {
const {paged, error} = action.payload; const {apiCall: {loading, error, timestamp, data}} = action.payload;
return update(state, {
return !state.paged ? update(state, { paged: {
paged: {$set: paged}, $set: {
pagedError: {$set: error}, loading,
}) : error,
update(state, { timestamp,
paged: { data: FilteredPage.merge(state.paged && state.paged.data, data),
content: {$push: paged.content},
number: {$set: paged.number},
last: {$set: paged.last},
}, },
pagedError: {$set: error}, },
}); });
} }
default: default:
......
...@@ -2,7 +2,6 @@ import update from 'immutability-helper'; ...@@ -2,7 +2,6 @@ import update from 'immutability-helper';
import { IReducerAction } from 'model/common.model'; import { IReducerAction } from 'model/common.model';
import { import {
RECEIVE_ACCESSIONS,
RECEIVE_ACCESSION, RECEIVE_ACCESSION,
RECEIVE_ACCESSION_OVERVIEW, RECEIVE_ACCESSION_OVERVIEW,
APPEND_ACCESSIONS, APPEND_ACCESSIONS,
...@@ -17,22 +16,19 @@ import AccessionMapInfo from 'model/accession/AccessionMapInfo'; ...@@ -17,22 +16,19 @@ import AccessionMapInfo from 'model/accession/AccessionMapInfo';
import AccessionOverview from 'model/accession/AccessionOverview'; import AccessionOverview from 'model/accession/AccessionOverview';
import AccessionAuditLog from 'model/accession/AccessionAuditLog'; import AccessionAuditLog from 'model/accession/AccessionAuditLog';
import MapLayer, { AVAILABLE_LAYERS } from 'model/genesys/MapTileLayer'; import MapLayer, { AVAILABLE_LAYERS } from 'model/genesys/MapTileLayer';
import ApiCall from 'model/ApiCall';
const INITIAL_STATE: { const INITIAL_STATE: {
accession: Accession; accession: ApiCall<Accession>;
auditLog: AccessionAuditLog, auditLog: ApiCall<AccessionAuditLog>,
accessionError: any; paged: ApiCall<FilteredPage<Accession>>;
paged: FilteredPage<Accession>; overview: ApiCall<AccessionOverview>;
pagedError: any; mapInfo: ApiCall<AccessionMapInfo>;
overview: AccessionOverview;
mapInfo: AccessionMapInfo;
mapLayers: MapLayer[] mapLayers: MapLayer[]
} = { } = {
accession: null, accession: null,
auditLog: null, auditLog: null,
accessionError: null,
paged: null, paged: null,
pagedError: null,
overview: null, overview: null,
mapInfo: null, mapInfo: null,
mapLayers: AVAILABLE_LAYERS, mapLayers: AVAILABLE_LAYERS,
...@@ -43,81 +39,72 @@ function publicAccessions(state = INITIAL_STATE, action: IReducerAction) { ...@@ -43,81 +39,72 @@ function publicAccessions(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) { switch (action.type) {
case RECEIVE_ACCESSION: { case RECEIVE_ACCESSION: {
const {accession, error} = action.payload; const {apiCall} = action.payload;
const receivedIndex = state.paged ? state.paged.content.findIndex((item) => item.uuid === accession.uuid) : -1; const receivedIndex = state.paged && apiCall.data ? state.paged.data.content.findIndex((item) => item.uuid === apiCall.data.uuid) : -1;
if (receivedIndex !== -1) { if (receivedIndex !== -1) {
return update(state, { return update(state, {
accession: { $set: accession }, accession: { $set: apiCall },
auditLog: {$set: null}, auditLog: {$set: null},
paged: { paged: {
content: { data: {
[receivedIndex]: {$set: accession}, content: {
[receivedIndex]: {$set: apiCall.data},
},
}, },
}, },