← back to Wine Finder Next

app/search/page.tsx

12 lines

// app/search/page.tsx
import { redirect } from 'next/navigation';

export default async function SearchPage({
  searchParams
}: {
  searchParams?: { q?: string }
}) {
  // Redirect to the wines page with the search query
  const query = searchParams?.q || '';
  redirect(`/wines${query ? `?q=${encodeURIComponent(query)}` : ''}`);
}