display badly filled partenaires
This commit is contained in:
parent
6f53afa8bf
commit
c2174b27c0
@ -3,18 +3,18 @@ import { getCleanDate, getRessourceItemCard } from './contentFetchUtils';
|
|||||||
|
|
||||||
export async function getPartenaires(rawContent) {
|
export async function getPartenaires(rawContent) {
|
||||||
const logoPromises = rawContent.map(item =>
|
const logoPromises = rawContent.map(item =>
|
||||||
REST.get(item.relationships.field_logo.links.related.href)
|
REST.get(item.relationships.field_logo?.links.related.href)
|
||||||
.then(logoFetch => ({
|
.then(logoFetch => ({
|
||||||
title: item.attributes.title,
|
title: item.attributes?.title,
|
||||||
description: item.attributes.body.value,
|
description: item.attributes?.body?.value,
|
||||||
weight: item.attributes.field_poid,
|
weight: item.attributes?.field_poid,
|
||||||
link_url: item.attributes.field_lien.uri,
|
link_url: item.attributes?.field_lien?.uri,
|
||||||
logo_alt: item.relationships.field_logo.data.meta.alt,
|
logo_alt: item.relationships?.field_logo?.data?.meta.alt,
|
||||||
logo_url: {
|
logo_url: {
|
||||||
original: logoFetch.data.data.attributes.uri.url,
|
original: logoFetch.data.data?.attributes.uri.url,
|
||||||
small: logoFetch.data.data.attributes.image_style_uri.content_small,
|
small: logoFetch.data.data?.attributes.image_style_uri.content_small,
|
||||||
medium: logoFetch.data.data.attributes.image_style_uri.content_medium,
|
medium: logoFetch.data.data?.attributes.image_style_uri.content_medium,
|
||||||
large: logoFetch.data.data.attributes.image_style_uri.content_large,
|
large: logoFetch.data.data?.attributes.image_style_uri.content_large,
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
@ -24,28 +24,28 @@ export async function getPartenaires(rawContent) {
|
|||||||
|
|
||||||
export async function getGouvernance(rawContent) {
|
export async function getGouvernance(rawContent) {
|
||||||
const itemPromises = rawContent.map(item =>
|
const itemPromises = rawContent.map(item =>
|
||||||
REST.get(item.relationships.field_personne_s.links.related.href)
|
REST.get(item.relationships.field_personne_s?.links.related.href)
|
||||||
.then(async personnesFetch => {
|
.then(async personnesFetch => {
|
||||||
const portraitPromises = personnesFetch.data.data.map(personne =>
|
const portraitPromises = personnesFetch.data.data.map(personne =>
|
||||||
REST.get(personne.relationships.field_portrait.links.related.href)
|
REST.get(personne.relationships.field_portrait?.links.related.href)
|
||||||
.then(portraitFetch => ({
|
.then(portraitFetch => ({
|
||||||
nom: personne.attributes.field_nom,
|
nom: personne.attributes.field_nom,
|
||||||
prenom: personne.attributes.field_prenom,
|
prenom: personne.attributes.field_prenom,
|
||||||
description: personne.attributes.field_description,
|
description: personne.attributes.field_description,
|
||||||
photo_meta: personne.relationships.field_portrait.data?.meta.alt,
|
photo_meta: personne.relationships.field_portrait.data?.meta.alt,
|
||||||
photo_url: portraitFetch.data.data ? {
|
photo_url: portraitFetch.data.data ? {
|
||||||
original: portraitFetch.data.data.attributes.uri.url,
|
original: portraitFetch.data.data?.attributes.uri.url,
|
||||||
small: portraitFetch.data.data.attributes.image_style_uri.content_small,
|
small: portraitFetch.data.data?.attributes.image_style_uri.content_small,
|
||||||
medium: portraitFetch.data.data.attributes.image_style_uri.content_medium,
|
medium: portraitFetch.data.data?.attributes.image_style_uri.content_medium,
|
||||||
large: portraitFetch.data.data.attributes.image_style_uri.content_large,
|
large: portraitFetch.data.data?.attributes.image_style_uri.content_large,
|
||||||
} : null
|
} : null
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
return Promise.all(portraitPromises)
|
return Promise.all(portraitPromises)
|
||||||
.then(personnes => ({
|
.then(personnes => ({
|
||||||
title: item.attributes.title,
|
title: item.attributes?.title,
|
||||||
weight: item.attributes.field_poid,
|
weight: item.attributes?.field_poid,
|
||||||
personnes
|
personnes
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
<p v-html="content.intro"></p>
|
<p v-html="content.intro"></p>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="partenaire in [...content.partenaires].sort((a, b) => a.weight - b.weight)" class="partenaire">
|
<div v-for="partenaire in [...content.partenaires].sort((a, b) => a.weight - b.weight)" class="partenaire">
|
||||||
<figure>
|
<figure v-if="partenaire.logo_url && partenaire.link_url">
|
||||||
<a :href="partenaire.link_url" target="_blank">
|
<a :href="partenaire.link_url" target="_blank">
|
||||||
<img :src="partenaire.logo_url.small" :alt="partenaire.logo_alt">
|
<img :src="partenaire.logo_url.small" :alt="partenaire.logo_alt">
|
||||||
</a>
|
</a>
|
||||||
</figure>
|
</figure>
|
||||||
<div class="title"><p v-html="partenaire.title"></p></div>
|
<div class="title"><p v-html="partenaire.title || ''"></p></div>
|
||||||
<div class="description"><p v-html="partenaire.description"></p></div>
|
<div class="description"><p v-html="partenaire.description || ''"></p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user