Skip to content

Commit 9bc5892

Browse files
authored
Merge pull request #393 from dataforgoodfr/positions_press_files
Fix on Positions page the display of press releases files
2 parents 42c4cf5 + c07185a commit 9bc5892

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

frontend/src/app/[locale]/positions/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ async function fetchPositionPageData() {
2929
},
3030
thumbnail: {
3131
populate: '*'
32+
},
33+
article_file: {
34+
fields: ['url']
3235
}
3336
}
3437
},
@@ -44,6 +47,9 @@ async function fetchPositionPageData() {
4447
},
4548
thumbnail: {
4649
populate: '*'
50+
},
51+
article_file: {
52+
fields: ['url']
4753
}
4854
}
4955
}

frontend/src/app/[locale]/positions/positions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function transformResources(resources: NonNullable<PositionsPageData['resources'
4444
title: isBlog ? (resource.blog as { title: string })?.title || '' : (resource.press_release as { title: string })?.title || '',
4545
tags: isBlog ? [new Date(resource.blog?.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })] : [new Date(resource.press_release?.published_date || '').toLocaleString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }), resource.press_release?.media_name],
4646
image: isBlog ? resource.blog?.thumbnail?.url || '/images/dataforgood.svg' : resource.press_release?.thumbnail?.url || "/images/dataforgood.svg",
47-
link: isBlog ? `/blog/${resource.blog?.slug || ''}` : getPressReleaseLink(resource as { press_release_type: string; article_link: string; article_file: {url: string;}}) || '',
47+
link: isBlog ? `/blog/${resource.blog?.slug || ''}` : getPressReleaseLink(resource.press_release as { press_release_type: string; article_link: string; article_file: {url: string;}}) || '',
4848
subInfos: isBlog ? (resource.blog as { tags: string[] })?.tags?.map((tag) => tag.name) || [] : (resource.press_release as { tags: string[] })?.tags || [],
4949
isBlank: true,
5050
}

0 commit comments

Comments
 (0)