'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 = `/home?year=${year}&month=${month}`; await gotoUrl(path); } export async function gotoHomeWithMessage(locale: string, message: string, yearMonth?: YearMonth) { const path = yearMonth ? `/${locale}/home?year=${yearMonth.year}&month=${yearMonth.month}&${message}=true` : `/${locale}/home?${message}=true`; await gotoUrl(path); } export async function gotoUrl(path: string) { console.log(path) revalidatePath(path, "page"); redirect(path); }