refactoring: changing param list of a fn
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user