From e314f994ded37b9ad09c46327bfa787e185b5214 Mon Sep 17 00:00:00 2001 From: ColinRgm Date: Mon, 27 Jan 2025 13:26:59 +0100 Subject: [PATCH] fix: create a const Closes: #233 --- nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx b/nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx index 16023fc..2a94068 100644 --- a/nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx +++ b/nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx @@ -83,6 +83,14 @@ export default function Page({ params }: { params: any }) { ); }; + + // Redirect if id don't exist + const inexistant_id = () => { + if (ip !== esp.ip) { + window.location.href = `/dashboard` + } + } + useEffect(() => { const precisionParam = searchParams.get("precision"); const fromParam = searchParams.get("from"); @@ -105,6 +113,7 @@ export default function Page({ params }: { params: any }) { router.push( `/dashboard/esp/${params.espId}?precision=${value}&from=${date?.from?.toISOString()}&to=${date?.to?.toISOString()}`, ); + inexistant_id(); }; const dateRangeInDays =