From 996c3793c7704c28cc39485de7bd634143031126 Mon Sep 17 00:00:00 2001 From: Jeremy PASTOURET Date: Mon, 7 Oct 2024 15:30:55 +0200 Subject: [PATCH 1/3] fix: gestion valeur null enfants --- src/router.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/router.ts b/src/router.ts index 95a18e8f98..01ccec5f72 100644 --- a/src/router.ts +++ b/src/router.ts @@ -359,9 +359,11 @@ router.beforeEach((to, from, next) => { if (current.includes(enfantPath)) { const id_enfant = current.split(enfantPath)[1].split("/")[0] - const hasStoreChild = store.situation.enfants.find( - (enfant) => enfant.id === `enfant_${id_enfant}` - ) + const hasStoreChild = store.situation.enfants + ? store.situation.enfants.find( + (enfant) => enfant.id === `enfant_${id_enfant}` + ) + : false if (!hasStoreChild) { // go(-2) used to skip the "/enfants" step on the removed child first step "_firstName" From 7f435d678fef9e827af8afc5eb87fe8a216926ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20PASTOURET?= Date: Fri, 11 Oct 2024 16:15:47 +0200 Subject: [PATCH 2/3] Update src/router.ts Co-authored-by: Simon Hamery --- src/router.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/router.ts b/src/router.ts index 01ccec5f72..25522ec8bd 100644 --- a/src/router.ts +++ b/src/router.ts @@ -359,11 +359,9 @@ router.beforeEach((to, from, next) => { if (current.includes(enfantPath)) { const id_enfant = current.split(enfantPath)[1].split("/")[0] - const hasStoreChild = store.situation.enfants - ? store.situation.enfants.find( - (enfant) => enfant.id === `enfant_${id_enfant}` - ) - : false + const hasStoreChild = store.situation.enfants?.some( + (enfant) => enfant.id === `enfant_${id_enfant}` + ) if (!hasStoreChild) { // go(-2) used to skip the "/enfants" step on the removed child first step "_firstName" From 1f3838392d8f4c196c3499412b86820e7449b8e5 Mon Sep 17 00:00:00 2001 From: Jeremy PASTOURET Date: Fri, 11 Oct 2024 17:33:33 +0200 Subject: [PATCH 3/3] fix: lint prettier --- src/router.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/router.ts b/src/router.ts index 25522ec8bd..17eaeb5ddb 100644 --- a/src/router.ts +++ b/src/router.ts @@ -359,9 +359,9 @@ router.beforeEach((to, from, next) => { if (current.includes(enfantPath)) { const id_enfant = current.split(enfantPath)[1].split("/")[0] - const hasStoreChild = store.situation.enfants?.some( - (enfant) => enfant.id === `enfant_${id_enfant}` - ) + const hasStoreChild = store.situation.enfants?.some( + (enfant) => enfant.id === `enfant_${id_enfant}` + ) if (!hasStoreChild) { // go(-2) used to skip the "/enfants" step on the removed child first step "_firstName"