diff --git a/src/core_modules/capture-core/events/getSubValues.js b/src/core_modules/capture-core/events/getSubValues.js index 19b36daf2a..7d61eb702a 100644 --- a/src/core_modules/capture-core/events/getSubValues.js +++ b/src/core_modules/capture-core/events/getSubValues.js @@ -37,19 +37,23 @@ const subValueGetterByElementType = { return null; }), [dataElementTypes.IMAGE]: ({ + value, eventId, metaElementId, absoluteApiPath, }: { + value: any, eventId: string, metaElementId: string, absoluteApiPath: string, }) => (featureAvailable(FEATURES.trackerImageEndpoint) ? { + value, url: `${absoluteApiPath}/tracker/events/${eventId}/dataValues/${metaElementId}/image`, previewUrl: `${absoluteApiPath}/tracker/events/${eventId}/dataValues/${metaElementId}/image?dimension=small`, } : { + value, url: `${absoluteApiPath}/events/files?dataElementUid=${metaElementId}&eventUid=${eventId}`, previewUrl: `${absoluteApiPath}/events/files?dataElementUid=${metaElementId}&eventUid=${eventId}&dimension=SMALL`, } @@ -67,11 +71,13 @@ const subValueGetterByElementType = { }) => { const ouIds = value.split('/'); const id = ouIds[ouIds.length - 1]; - return querySingleResource({ resource: 'organisationUnits', + return querySingleResource({ + resource: 'organisationUnits', id, params: { fields: 'id,code,displayName,path', - } }) + }, + }) .then(res => ({ id: res.id, code: res.code,