dm: 콘텐츠 관련 refresh
This commit is contained in:
@@ -1,9 +1,26 @@
|
||||
export const dynamic = "force-dynamic";
|
||||
import { ContentsPage } from "@/components/ui/contents";
|
||||
import { revalidateTag } from "next/cache";
|
||||
import { Button } from "@common/components/ui/button";
|
||||
|
||||
export default async function Contents() {
|
||||
const contsSn = 28;
|
||||
const menuCd = "24";
|
||||
/**
|
||||
* 'dm-content-detail' 태그를 가진 캐시 데이터를 즉시 무효화하는 서버 액션입니다.
|
||||
* 버튼 클릭 시 실행되며, 이후 이 태그를 사용하는 모든 페이지는 최신 데이터를 다시 가져옵니다.
|
||||
*/
|
||||
async function revalidateAction() {
|
||||
"use server";
|
||||
revalidateTag("dm-content-detail");
|
||||
console.log("Cache revalidated for tag: dm-content-detail");
|
||||
}
|
||||
|
||||
return <ContentsPage contsSn={contsSn} menuCd={menuCd} />;
|
||||
return (
|
||||
<div className="container mx-auto p-10">
|
||||
<div className="bg-white p-8 rounded-xl shadow-sm border border-gray-200 text-center">
|
||||
<h1 className="text-2xl font-bold mb-2">콘텐츠 관리 도구</h1>
|
||||
<p className="text-gray-500 mb-6">변경된 콘텐츠 내용을 즉시 반영하려면 아래 버튼을 클릭하세요.</p>
|
||||
<form action={revalidateAction}>
|
||||
<Button type="submit" className="px-8">캐시 즉시 갱신 (dm-content-detail)</Button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user