Files
frontend/apps/sn/app/(map-layout)/map/agedPipePopup/page.tsx
T

31 lines
809 B
TypeScript

import { redirect } from "next/navigation";
type LegacyAgedPipePopupPageProps = {
searchParams: Promise<Record<string, string | string[] | undefined>>;
};
export default async function LegacyAgedPipePopupPage({
searchParams,
}: LegacyAgedPipePopupPageProps) {
const resolvedSearchParams = await searchParams;
const nextSearchParams = new URLSearchParams();
Object.entries(resolvedSearchParams).forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach((item) => nextSearchParams.append(key, item));
return;
}
if (typeof value === "string") {
nextSearchParams.set(key, value);
}
});
const queryString = nextSearchParams.toString();
redirect(
queryString
? `/popup/agedPipePopup?${queryString}`
: "/popup/agedPipePopup",
);
}