From a1abc450bfb2ef7e1aa245f8ec154d4c513275e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Thu, 1 Feb 2024 14:38:26 +0100 Subject: [PATCH] forms: gotoHome activating previously active month --- app/ui/BillDeleteForm.tsx | 2 +- app/ui/BillEditForm.tsx | 2 +- app/ui/LocationEditForm.tsx | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/ui/BillDeleteForm.tsx b/app/ui/BillDeleteForm.tsx index 1427625..3be7946 100644 --- a/app/ui/BillDeleteForm.tsx +++ b/app/ui/BillDeleteForm.tsx @@ -19,7 +19,7 @@ export const BillDeleteForm:FC = ({ bill, location }) => const [ state, dispatch ] = useFormState(handleAction, null); const handleCancel = () => { - gotoHome(`/?year=${location.yearMonth.year}`); + gotoHome(`/?year=${location.yearMonth.year}&month=${location.yearMonth.month}`); }; return( diff --git a/app/ui/BillEditForm.tsx b/app/ui/BillEditForm.tsx index 21ce677..215facd 100644 --- a/app/ui/BillEditForm.tsx +++ b/app/ui/BillEditForm.tsx @@ -37,7 +37,7 @@ export const BillEditForm:FC = ({ location, bill }) => { // redirect to the main page const handleCancel = () => { - gotoHome(billYear ? `/?year=${billYear}` : undefined); + gotoHome(billYear ? `/?year=${billYear}&month=${location.yearMonth.month}` : undefined); }; const billPaid_handleChange = (event: React.ChangeEvent) => { diff --git a/app/ui/LocationEditForm.tsx b/app/ui/LocationEditForm.tsx index 1f236cd..d7c305a 100644 --- a/app/ui/LocationEditForm.tsx +++ b/app/ui/LocationEditForm.tsx @@ -24,8 +24,7 @@ export const LocationEditForm:FC = ({ location, yearMonth // redirect to the main page const handleCancel = () => { - console.log('handleCancel'); - gotoHome(location ? `/?year=${location?.yearMonth?.year}` : undefined); + gotoHome(location ? `/?year=${location?.yearMonth?.year}&month=${location?.yearMonth?.month}` : undefined); }; return(