Skip to content

Commit

Permalink
feat: 测试 revalidate
Browse files Browse the repository at this point in the history
  • Loading branch information
huayemao committed Jan 5, 2024
1 parent e86695b commit e4e5a8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/admin/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

export default async function AdminSettingsPage({ params }) {
export default function AdminSettingsPage({ params }) {
return (
<main className="w-full px-8 py-4">
<section className="flex flex-col gap-2 w-36 items-start">
Expand All @@ -11,6 +11,13 @@ export default async function AdminSettingsPage({ params }) {
>
重新渲染首页
</button>
<button
onClick={() => {
fetch("/api/revalidate?path=/(home)");
}}
>
重新渲染首页1
</button>
</section>
</main>
);
Expand Down
2 changes: 2 additions & 0 deletions app/api/updatePost/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export async function revalidateHomePage(id: number) {
});

if (firstPagePosts.some((e) => e.id === id)) {
console.log('should revalidate home page')
revalidatePath("/(home)", "page");
revalidatePath("/", "page");
}
}

1 comment on commit e4e5a8c

@vercel
Copy link

@vercel vercel bot commented on e4e5a8c Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dors – ./

dors-git-main-huayemao.vercel.app
dors.huayemao.run
dors-huayemao.vercel.app

Please sign in to comment.