Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
12 lines
752 B
TypeScript
12 lines
752 B
TypeScript
import { isLocale } from '@barev/i18n';
|
|
import { notFound, permanentRedirect } from 'next/navigation';
|
|
|
|
/** Версия 2 «Переезд по шагам» стала главной — старые ссылки /land2 ведут на неё с теми же параметрами */
|
|
export default async function Land2({ params, searchParams }: { params: Promise<{ locale: string }>; searchParams: Promise<Record<string, string | string[] | undefined>> }) {
|
|
const [{ locale }, sp] = await Promise.all([params, searchParams]);
|
|
if (!isLocale(locale)) notFound();
|
|
const qs = new URLSearchParams();
|
|
for (const [k, v] of Object.entries(sp)) if (typeof v === 'string') qs.set(k, v);
|
|
permanentRedirect(`/${locale}${qs.size ? `?${qs}` : ''}`);
|
|
}
|