File tree 2 files changed +15
-12
lines changed 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import { getMetadataAsync } from "@/common/metadata"
3
3
import SearchPage from "@/app-pages/SearchPage/SearchPage"
4
+ import type { PageParams } from "@/app/types"
4
5
5
- type SearchParams = {
6
- [ key : string ] : string | string [ ] | undefined
7
- }
8
-
9
- export async function generateMetadata ( {
10
- searchParams,
11
- } : {
12
- searchParams : Promise < SearchParams >
13
- } ) {
6
+ export async function generateMetadata ( { searchParams } : PageParams ) {
14
7
return await getMetadataAsync ( {
15
8
title : "Search" ,
16
9
searchParams,
@@ -29,7 +22,8 @@ export async function generateMetadata({
29
22
*/
30
23
export const dynamic = "force-dynamic"
31
24
32
- const Page : React . FC = ( ) => {
25
+ const Page : React . FC = ( { searchParams } : PageParams ) => {
26
+ console . log ( "searchParams" , searchParams )
33
27
return < SearchPage />
34
28
}
35
29
Original file line number Diff line number Diff line change @@ -2,7 +2,16 @@ export type SearchParams = {
2
2
[ key : string ] : string | string [ ] | undefined
3
3
}
4
4
5
- export type PageParams < RouteParams = Record < string , never > > = {
6
- params ? : Promise < RouteParams >
5
+ type PageParamsWithRouteParams < RouteParams > = {
6
+ params : Promise < RouteParams >
7
7
searchParams ?: Promise < SearchParams >
8
8
}
9
+
10
+ type PageParamsWithoutRouteParams = {
11
+ searchParams ?: Promise < SearchParams >
12
+ }
13
+
14
+ export type PageParams < RouteParams = Record < string , never > > =
15
+ RouteParams extends Record < string , never >
16
+ ? PageParamsWithoutRoute
17
+ : PageParamsWithRoute < RouteParams >
You can’t perform that action at this time.
0 commit comments