From cdac8e1a541ae1d4a4c0e82c2da1d83f7fca26fe Mon Sep 17 00:00:00 2001 From: Adrien Chauve Date: Wed, 13 Dec 2023 16:08:36 +0100 Subject: [PATCH] fix: catch exceptions in formulaire --- formulaire/pages/api/dossier/[id].tsx | 2 +- formulaire/pages/api/enfants/[id].tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/formulaire/pages/api/dossier/[id].tsx b/formulaire/pages/api/dossier/[id].tsx index 134383c13..2553879c4 100644 --- a/formulaire/pages/api/dossier/[id].tsx +++ b/formulaire/pages/api/dossier/[id].tsx @@ -41,7 +41,7 @@ const remove: NextApiHandler = async (req, res) => { const url = `${process.env.API_URL_INSTRUCTEUR}/inc/dossiers/${dossierId}`; - const fetching = fetch(url, { + const fetching = await fetch(url, { body: JSON.stringify({ api_key: process.env.API_KEY_SDP }), method: "DELETE", }).then(async (r) => { diff --git a/formulaire/pages/api/enfants/[id].tsx b/formulaire/pages/api/enfants/[id].tsx index 0ed40eb17..126281072 100644 --- a/formulaire/pages/api/enfants/[id].tsx +++ b/formulaire/pages/api/enfants/[id].tsx @@ -31,7 +31,7 @@ const remove: NextApiHandler = async (req, res) => { const url = `${process.env.API_URL_INSTRUCTEUR}/inc/enfant/${enfantId}`; - const fetching = fetch(url, { + const fetching = await fetch(url, { body: JSON.stringify({ api_key: process.env.API_KEY_SDP }), method: "DELETE", }).then(async (r) => {