From 4c15cab607b980531ceb138ab4ffb86a2aa166c5 Mon Sep 17 00:00:00 2001 From: Mohamed Maoulainine Maoulainine Date: Sat, 10 May 2025 23:16:08 +0200 Subject: [PATCH] fix: still working on the pending --- .../src/components/LoginComponent.vue | 5 +- front/MyINPulse-front/src/router/router.ts | 6 +++ .../src/services/Apis/Entrepreneurs.ts | 48 +++++++++++++++++++ .../src/views/PendingApproval.vue | 41 ++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 front/MyINPulse-front/src/views/PendingApproval.vue diff --git a/front/MyINPulse-front/src/components/LoginComponent.vue b/front/MyINPulse-front/src/components/LoginComponent.vue index acf1399..5d8b29a 100644 --- a/front/MyINPulse-front/src/components/LoginComponent.vue +++ b/front/MyINPulse-front/src/components/LoginComponent.vue @@ -34,7 +34,10 @@ onMounted(() => { checkPending( (response) => { const isValidated = response.data === true; - if (isValidated && roles.includes("MyINPulse-entrepreneur")) { + if ( + isValidated && + roles.includes("MyINPulse-entrepreneur") + ) { router.push("/canvas"); //router.push("/JorCproject"); } else { diff --git a/front/MyINPulse-front/src/router/router.ts b/front/MyINPulse-front/src/router/router.ts index 5704b61..bb81468 100644 --- a/front/MyINPulse-front/src/router/router.ts +++ b/front/MyINPulse-front/src/router/router.ts @@ -46,6 +46,12 @@ const router = createRouter({ name: "finalize", component: () => import("../views/FinalizeAccount.vue"), }, + + { + path: "/pending-approval", + name: "PendingApproval", + component: () => import("@/views/PendingApproval.vue"), + }, ], }); diff --git a/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts index 0e7e1af..cbd39a1 100644 --- a/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts +++ b/front/MyINPulse-front/src/services/Apis/Entrepreneurs.ts @@ -123,10 +123,58 @@ function removeSectionCell( }); } +// Checks if the entrepreneur has a pending project request +function checkPendingProjectRequest( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/entrepreneur/projects/has-pending-request") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + +// Checks if the entrepreneur has an active project +function checkIfProjectIsActive( + onSuccessHandler?: (response: AxiosResponse) => void, + onErrorHandler?: (error: AxiosError) => void +): void { + axiosInstance + .get("/entrepreneur/projects/project-is-active") + .then((response) => { + if (onSuccessHandler) { + onSuccessHandler(response); + } else { + defaultApiSuccessHandler(response); + } + }) + .catch((error: AxiosError) => { + if (onErrorHandler) { + onErrorHandler(error); + } else { + defaultApiErrorHandler(error); + } + }); +} + export { getEntrepreneurProjectId, requestProjectCreation, addSectionCell, modifySectionCell, removeSectionCell, + checkPendingProjectRequest, + checkIfProjectIsActive, }; diff --git a/front/MyINPulse-front/src/views/PendingApproval.vue b/front/MyINPulse-front/src/views/PendingApproval.vue new file mode 100644 index 0000000..031ffc2 --- /dev/null +++ b/front/MyINPulse-front/src/views/PendingApproval.vue @@ -0,0 +1,41 @@ + + + + +