From 8154814805dc4fbe1b97eb02f2f87ce5f7af9014 Mon Sep 17 00:00:00 2001 From: ALAMI Adnane Date: Thu, 1 May 2025 17:35:04 +0200 Subject: [PATCH] fix: type errors --- .../src/components/canvas/CanvasItem.vue | 11 +++++++++++ .../src/services/Apis/Entrepreneurs.ts | 2 +- front/MyINPulse-front/src/views/CanvasView.vue | 9 +++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue index ccd14bf..5c04b62 100755 --- a/front/MyINPulse-front/src/components/canvas/CanvasItem.vue +++ b/front/MyINPulse-front/src/components/canvas/CanvasItem.vue @@ -189,6 +189,17 @@ const fetchData = async ( handleFetchSuccess(responseData); } else { if (projectId == -1) { + const errorCell = new SectionCell({ + idSectionCell: -1, + sectionId: -1, + contentSectionCell: "Échec du chargement des données.", + modificationDate: new Date().toISOString(), + }); + + currentDescriptions.value = [errorCell]; + editedDescriptions.value = [errorCell]; + isEditing.value = [false]; + console.error( "No sections to show because no project was found." ); diff --git a/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts index cb10fb5..0e7e1af 100644 --- a/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts +++ b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts @@ -78,7 +78,7 @@ function addSectionCell( function modifySectionCell( sectionCellId: number, - sectionCellDetails: SectionCell, // Replace 'any' with a proper type for section cell details if available + sectionCellDetails: SectionCell, onSuccessHandler?: (response: AxiosResponse) => void, onErrorHandler?: (error: AxiosError) => void ): void { diff --git a/front/MyINPulse-front/src/views/CanvasView.vue b/front/MyINPulse-front/src/views/CanvasView.vue index 975f665..681b3e2 100644 --- a/front/MyINPulse-front/src/views/CanvasView.vue +++ b/front/MyINPulse-front/src/views/CanvasView.vue @@ -91,14 +91,14 @@ const fetchAdminData = (projectId: number, useMock = IS_MOCK_MODE) => { } if (projectId === -1) { - admin.value = { + admin.value = new UserAdmin({ idUser: 0, userSurname: "Erreur", userName: "Chargement", primaryMail: "N/A", secondaryMail: "N/A", phoneNumber: "N/A", - }; + }); return; } @@ -112,14 +112,15 @@ const fetchAdminData = (projectId: number, useMock = IS_MOCK_MODE) => { "Erreur lors de la récupération des données de l'administrateur :", error ); - admin.value = { + + admin.value = new UserAdmin({ idUser: 0, userSurname: "Erreur", userName: "Chargement", primaryMail: "N/A", secondaryMail: "N/A", phoneNumber: "N/A", - }; + }); } ); };