Files
evidencija-rezija/app/lib/actions/navigationActions.ts
Knee Cola 5bbf80c2ae Implement redirect with toast notification on profile save
- Add gotoHomeWithMessage function to navigationActions
- Redirect to home page after successful profile save
- Display success message in toast notification instead of in-form
- Check for profileSaved URL parameter on home page mount
- Clean up URL parameter after showing toast
- Move success message translation to home-page section
- Remove unused success state and message from AccountForm
- Remove useEffect import from AccountForm

User experience: After saving profile, users are redirected to the
familiar home screen and see a toast notification confirming the save.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 18:58:43 +01:00

22 lines
559 B
TypeScript

'use server';
import { revalidatePath } from "next/cache";
import { redirect } from 'next/navigation';
import { YearMonth } from "../db-types";
export async function gotoHome({year, month}: YearMonth) {
const path = `/?year=${year}&month=${month}`;
await gotoUrl(path);
}
export async function gotoHomeWithMessage(locale: string, message: string) {
const path = `/${locale}?${message}=true`;
await gotoUrl(path);
}
export async function gotoUrl(path: string) {
console.log(path)
revalidatePath(path, "page");
redirect(path);
}