From 43764cf0bd89ed805f6653e37d598378e2c7b06b Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Thu, 4 May 2023 18:13:13 +0200 Subject: [PATCH] Fixed a bug where repMandate wasn't the correct data --- src/components/RepInfo.vue | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/RepInfo.vue b/src/components/RepInfo.vue index 12d743f..3790968 100644 --- a/src/components/RepInfo.vue +++ b/src/components/RepInfo.vue @@ -20,7 +20,7 @@ const repFullName = computed( const repMandate = computed(() => { const parliamentMandate = props.rep.acteur.mandats.mandat.find( - (mandate) => mandate["@xsi:type"] === "MandatParlementaire_type" + (mandate) => mandate.typeOrgane === "ASSEMBLEE" ); return parliamentMandate; }); @@ -55,12 +55,20 @@ const repLinkedin = computed(() => { return data; }); -const regionBgFile = computed( - () => - `regions/${String(repMandate.value?.election?.lieu.region) +const regionBgFile = computed(() => { + if ( + repMandate.value?.election?.lieu.departement === + "Français établis hors de France" + ) { + return `regions/fr-etranger-${String( + repMandate.value?.election?.lieu.numCirco + )}.svg`; + } else { + return `regions/${String(repMandate.value?.election?.lieu.region) .toLocaleLowerCase() - .replace(/\s/g, "-")}.svg` -); + .replace(/\s/g, "-")}.svg`; + } +});