import type { ReadonlyURLSearchParams } from "next/navigation";

export function getPostLoginRedirect(searchParams: ReadonlyURLSearchParams): string {
  const dest = searchParams.get("redirect") || "/dashboard";
  // prevent open redirects
  if (dest.startsWith("http://") || dest.startsWith("https://")) return "/dashboard";
  return dest;
}
