/** * Get the base URL for auth redirects. * Uses NEXT_PUBLIC_SITE_URL in production, falls back to window.location.origin for local dev. */ export function getBaseUrl(): string { if (process.env.NEXT_PUBLIC_SITE_URL) { return process.env.NEXT_PUBLIC_SITE_URL; } if (typeof window !== "undefined") { return window.location.origin; } return "http://localhost:3000"; }