type params as promise
This commit is contained in:
@@ -50,14 +50,12 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
|
||||
export default async function SearchPage(props: SearchPageProps) {
|
||||
const params = await props.params
|
||||
const { category } = params
|
||||
|
||||
const { results, count } = await fetchRoutes(category)
|
||||
const { results, count } = await fetchRoutes(params.category || '')
|
||||
|
||||
return (
|
||||
<div className="container mx-auto p-4">
|
||||
<h1 className="mb-4 text-2xl font-bold">
|
||||
{category === 'mover' ? 'Поиск перевозчика' : 'Поиск посылки'}
|
||||
{params.category === 'mover' ? 'Поиск перевозчика' : 'Поиск посылки'}
|
||||
</h1>
|
||||
|
||||
<Suspense fallback={<div>Загрузка результатов...</div>}>
|
||||
|
||||
@@ -233,10 +233,6 @@ export interface SearchResponse {
|
||||
}
|
||||
|
||||
export interface SearchPageProps {
|
||||
params: {
|
||||
category: string
|
||||
}
|
||||
searchParams: {
|
||||
[key: string]: string | string[] | undefined
|
||||
}
|
||||
params: Promise<{ category?: string }>
|
||||
searchParams?: Promise<{ [key: string]: string | string[] | undefined }>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user