import { redirect } from "next/navigation";

export default async function PartsRoleRedirectPage({
  params,
  searchParams,
}: {
  params: { partRole: string };
  searchParams?: { platform?: string };
}) {
  const partRole = params.partRole;
  const platform = searchParams?.platform ?? "AR-15";

  redirect(`/parts/p/${encodeURIComponent(platform)}/${encodeURIComponent(partRole)}`);
}