refactoring: changing param list of a fn

This commit is contained in:
2024-02-01 15:07:30 +01:00
parent a1abc450bf
commit 2261e83715
8 changed files with 26 additions and 18 deletions

View File

@@ -2,8 +2,15 @@
import { revalidatePath } from "next/cache";
import { redirect } from 'next/navigation';
import { YearMonth } from "../db-types";
export async function gotoHome(path: string = '/') {
export async function gotoHome({year, month}: YearMonth) {
const path = `/?year=${year}&month=${month}`;
await gotoUrl(path);
}
export async function gotoUrl(path: string) {
console.log(path)
revalidatePath(path, "page");
redirect(path);
}