diff options
| author | joonhoekim <26rote@gmail.com> | 2025-08-12 09:50:35 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-08-12 09:50:35 +0000 |
| commit | 58dd81f6208199791e7451a1cb239f23bcd0a20f (patch) | |
| tree | 365d6e0f15a5df9be09bda8061af1d3118c84c77 /lib/revalidate.ts | |
| parent | bcd462d6e60871b86008e072f4b914138fc5c328 (diff) | |
(김준회) 결재 템플릿 및 결재선 관리 revalidate 처리, 결재선 관리 카테고리 처리
Diffstat (limited to 'lib/revalidate.ts')
| -rw-r--r-- | lib/revalidate.ts | 32 |
1 files changed, 32 insertions, 0 deletions
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<void> { + for (const lng of languages) { + try { + revalidatePath(`/${lng}${basePath}`) + } catch { + // ignore + } + } +} + +/** + * 여러 base 경로를 한 번에 무효화합니다. + */ +export async function revalidateI18nPathsMany(basePaths: string[]): Promise<void> { + for (const basePath of basePaths) { + await revalidateI18nPaths(basePath) + } +} + + |
