Skip to content

Commit

Permalink
fix: create a const
Browse files Browse the repository at this point in the history
Closes: #233
  • Loading branch information
ColinRgm committed Jan 27, 2025
1 parent f92bb33 commit e314f99
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nextjs-interface/src/app/dashboard/esp/[espId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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 =
Expand Down

0 comments on commit e314f99

Please sign in to comment.