From a9b74a57166ae5c0ff1b769947d0ea4ab734d8ca Mon Sep 17 00:00:00 2001 From: Vins Date: Wed, 12 Jun 2024 10:02:18 +0200 Subject: [PATCH] Fixed client dashboard when no notes --- .../Components/Layouts/ClientDashboard/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 186e40da..6f080624 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -57,8 +57,15 @@ export default function ClientDashboard(props: IProps) { const actualCustomer = folder?.customers?.find((customer) => customer.contact?.email === jwt?.email); if (!actualCustomer) throw new Error("Customer not found"); - const note = folder.notes?.find((note) => note.customer?.uid === actualCustomer.uid); - if (!note) throw new Error("Note not found"); + let note = folder.notes?.find((note) => note.customer?.uid === actualCustomer.uid); + // if (!note) throw new Error("Note not found"); + if (!note) { + note = { + content: "Aucune note", + created_at: new Date(), + updated_at: new Date(), + }; + } const query: IGetDocumentsparams = { where: { depositor: { uid: actualCustomer.uid }, folder_uid: folderUid as string },