From 58dd81f6208199791e7451a1cb239f23bcd0a20f Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 12 Aug 2025 09:50:35 +0000 Subject: (김준회) 결재 템플릿 및 결재선 관리 revalidate 처리, 결재선 관리 카테고리 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/revalidate.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/revalidate.ts (limited to 'lib/revalidate.ts') diff --git a/lib/revalidate.ts b/lib/revalidate.ts new file mode 100644 index 00000000..08c572ee --- /dev/null +++ b/lib/revalidate.ts @@ -0,0 +1,32 @@ +"use server" + +import { revalidatePath } from "next/cache" +import { languages } from "@/i18n/settings" + +/** + * 지정된 base 경로에 대해 지원 언어별로 revalidatePath를 호출합니다. + * 예: basePath가 "/evcp/approval/line" 이면 + * - /ko/evcp/approval/line + * - /en/evcp/approval/line + * 등의 경로를 무효화합니다. + */ +export async function revalidateI18nPaths(basePath: string): Promise { + for (const lng of languages) { + try { + revalidatePath(`/${lng}${basePath}`) + } catch { + // ignore + } + } +} + +/** + * 여러 base 경로를 한 번에 무효화합니다. + */ +export async function revalidateI18nPathsMany(basePaths: string[]): Promise { + for (const basePath of basePaths) { + await revalidateI18nPaths(basePath) + } +} + + -- cgit v1.2.3