Skip to content

Commit

Permalink
fix: [DHIS2-18228] Image Deleted on Update (#3857)
Browse files Browse the repository at this point in the history
* fix: image deleted on update

* fix: remove call to fileresources
  • Loading branch information
henrikmv authored Oct 29, 2024
1 parent 52f7822 commit 4656864
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core_modules/capture-core/events/getSubValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
}
Expand All @@ -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,
Expand Down

0 comments on commit 4656864

Please sign in to comment.