Skip to content

Commit

Permalink
modified root page
Browse files Browse the repository at this point in the history
  • Loading branch information
ipipi2024 committed Nov 9, 2024
1 parent 2ac5889 commit 133a3a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/(root)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import Image from 'next/image'
import Link from 'next/link'

export default async function Home({ searchParams }: SearchParamProps) {
const page = Number(searchParams?.page) || 1;
const searchText = (searchParams?.query as string) || '';
const category = (searchParams?.category as string) || '';
// Destructure and await searchParams before using its properties
const { page: pageParam, query, category: categoryParam } = await searchParams;

// Use Number and fallback defaults after destructuring
const page = Number(pageParam) || 1;
const searchText = (query as string) || '';
const category = (categoryParam as string) || '';

const events = await getAllEvents({
query: searchText,
Expand Down

0 comments on commit 133a3a2

Please sign in to comment.