filtre ressources par étape + triées par ordre chrono

This commit is contained in:
2025-05-20 20:07:03 +02:00
parent e7a5e163ff
commit bfb39a0259
6 changed files with 66 additions and 5 deletions

View File

@@ -120,6 +120,8 @@ export async function getRessourceItemCard(item) {
vignette = null;
}
}
const relatedEtape = await REST.get(item.relationships.field_etape.links.related.href);
return {
ressourceType: item.attributes.field_type_de_ressource,
@@ -127,6 +129,7 @@ export async function getRessourceItemCard(item) {
auteurice: item.attributes.field_autheurice,
date: getCleanDate(item.attributes.field_date_ressource),
url: ressourceFetch.data.data.attributes.metatag.find(tag => tag.tag === "link")?.attributes.href,
relatedEtape: relatedEtape.data.data.attributes.title,
vignette
};
} catch (error) {

View File

@@ -55,6 +55,8 @@ export async function getGouvernance(rawContent) {
}
export async function getRessources(rawContent) {
console.log(rawContent);
const ressourcesPromises = rawContent.map(item => getRessourceItemCard(item));
return await Promise.all(ressourcesPromises);