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