chore: baseline import

This commit is contained in:
Codex
2026-04-23 01:08:18 +08:00
commit c8ddfdf660
260 changed files with 117643 additions and 0 deletions
@@ -0,0 +1,43 @@
'use server'
import { revalidatePath } from 'next/cache'
import { redirect } from 'next/navigation'
const CACHE_PATHS = [
'/en',
'/zh',
'/en/about',
'/zh/about',
'/en/dealers',
'/zh/dealers',
'/en/downloads',
'/zh/downloads',
'/en/news',
'/zh/news',
'/en/products',
'/zh/products',
'/en/support',
'/zh/support',
'/en/support/contact',
'/zh/support/contact',
'/en/support/faq',
'/zh/support/faq',
'/en/support/warranty',
'/zh/support/warranty',
] as const
function normalizeReturnPath(value: FormDataEntryValue | null) {
if (typeof value !== 'string') return '/admin'
if (!value.startsWith('/admin')) return '/admin'
return value
}
export async function clearFrontendCache(formData: FormData) {
const returnTo = normalizeReturnPath(formData.get('returnTo'))
for (const path of CACHE_PATHS) {
revalidatePath(path)
}
redirect(`${returnTo}${returnTo.includes('?') ? '&' : '?'}cache=cleared`)
}