Update navigation to preserve year/month context in redirects

Modified gotoHomeWithMessage to accept optional yearMonth parameter and
updated location actions to redirect with year/month context after save/delete.

Changes:
- Updated gotoHomeWithMessage to accept yearMonth parameter
- Modified redirect URLs to include year and month query params
- updateOrAddLocation now redirects to /${locale}?year=${year}&month=${month}&locationSaved=true
- deleteLocationById now redirects to /${locale}?year=${year}&month=${month}&locationDeleted=true
- Removed unused gotoHome import from locationActions

This ensures users return to the same month view after location operations,
maintaining context and providing success feedback via URL parameters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-18 09:05:25 +01:00
parent 9ae023cc94
commit 5dd7d40edf
2 changed files with 8 additions and 5 deletions

View File

@@ -9,8 +9,10 @@ export async function gotoHome({year, month}: YearMonth) {
await gotoUrl(path);
}
export async function gotoHomeWithMessage(locale: string, message: string) {
const path = `/${locale}?${message}=true`;
export async function gotoHomeWithMessage(locale: string, message: string, yearMonth?: YearMonth) {
const path = yearMonth
? `/${locale}?year=${yearMonth.year}&month=${yearMonth.month}&${message}=true`
: `/${locale}?${message}=true`;
await gotoUrl(path);
}