From af61ead3b128b09e1515a702ff49f095f7d95b0e Mon Sep 17 00:00:00 2001 From: Jepp9350 <2jepp9350@gmail.com> Date: Tue, 4 Mar 2025 11:52:54 +0100 Subject: [PATCH] Wrap components with NotFoundFallBackPageWrapper for validation. Added NotFoundFallBackPageWrapper across various department-related components to handle scenarios where the department ID is missing or inaccessible. Also updated getDepartmentIdFromUrl to ensure valid department IDs are returned. --- src/components/session/token/SessionUser.vue | 2 +- .../modules/Pos/DepartmentPos.vue | 9 +- .../modules/Pos/DepartmentPosOrder.vue | 2 +- .../modules/Pos/DepartmentPosOrders.vue | 11 ++- .../modules/bookings/DepartmentBookings.vue | 5 +- .../daily-report/DepartmentDailyReport.vue | 83 ++++++++++--------- 6 files changed, 64 insertions(+), 48 deletions(-) diff --git a/src/components/session/token/SessionUser.vue b/src/components/session/token/SessionUser.vue index 01b2feb7..7ffe9a14 100644 --- a/src/components/session/token/SessionUser.vue +++ b/src/components/session/token/SessionUser.vue @@ -271,7 +271,7 @@ export const SessionUser = { getDepartmentIdFromUrl: () => { // Check if the department id is in the route const router = useRouter(); - return parseInt(router.currentRoute.value.params.departmentId); + return parseInt(router.currentRoute.value.params.departmentId) > 0 ? parseInt(router.currentRoute.value.params.departmentId) : undefined; }, /** Redirect to */ redirectTo: { diff --git a/src/views/dashboards/departmentDashboard/modules/Pos/DepartmentPos.vue b/src/views/dashboards/departmentDashboard/modules/Pos/DepartmentPos.vue index f0ec0d86..26f6a980 100644 --- a/src/views/dashboards/departmentDashboard/modules/Pos/DepartmentPos.vue +++ b/src/views/dashboards/departmentDashboard/modules/Pos/DepartmentPos.vue @@ -8,6 +8,7 @@ import RestrictedPageWrapper from "@/components/page/wrappers/RestrictedPageWrap import { SessionUser } from "@/components/session/token/SessionUser.vue"; import DepartmentDashboardPageWrapper from "@/views/dashboards/departmentDashboard/DepartmentDashboardPageWrapper.vue"; import PageTitle from "@/components/global/PageTitle.vue"; +import NotFoundFallBackPageWrapper from "@/components/page/wrappers/NotFoundFallBackPageWrapper.vue";