Skip to content

Commit 14d49ae

Browse files
committed
Page arg types
1 parent 84eb78a commit 14d49ae

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

frontends/api/src/test-utils/urls.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import type {
99
NewsEventsApiNewsEventsListRequest,
1010
TestimonialsApi,
11+
ChannelsApi,
1112
} from "../generated/v0"
1213
import type {
1314
LearningResourcesApi as LRApi,
@@ -179,7 +180,7 @@ const channels = {
179180
details: (channelType: string, name: string) =>
180181
`${API_BASE_URL}/api/v0/channels/type/${channelType}/${name}/`,
181182
patch: (id: number) => `${API_BASE_URL}/api/v0/channels/${id}/`,
182-
list: (params?: Params<ChannelsApi, "channelsList">) =>
183+
list: (params?: Paramsv0<ChannelsApi, "channelsList">) =>
183184
`${API_BASE_URL}/api/v0/channels/${query(params)}`,
184185
}
185186

frontends/main/src/app/about/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react"
22
import { Metadata } from "next"
3-
43
import { AboutPage } from "@/app-pages/AboutPage/AboutPage"
54
import { standardizeMetadata } from "@/common/metadata"
65

frontends/main/src/app/c/[channelType]/[name]/page.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { channelsApi } from "api/clients"
44
import { ChannelTypeEnum } from "api/v0"
55
import { getMetadataAsync } from "@/common/metadata"
66
import handleNotFound from "@/common/handleNotFound"
7-
8-
type SearchParams = {
9-
[key: string]: string | string[] | undefined
10-
}
7+
import type { PageParams } from "@/app/types"
118

129
type RouteParams = {
1310
channelType: ChannelTypeEnum
@@ -17,10 +14,7 @@ type RouteParams = {
1714
export async function generateMetadata({
1815
searchParams,
1916
params,
20-
}: {
21-
searchParams: Promise<SearchParams>
22-
params: Promise<RouteParams>
23-
}) {
17+
}: PageParams<RouteParams>) {
2418
const { channelType, name } = await params
2519

2620
const { data } = await handleNotFound(

frontends/main/src/app/dashboard/[tab]/[id]/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react"
22
import DashboardPage from "@/app-pages/DashboardPage/DashboardPage"
3-
43
import { Metadata } from "next"
54
import { standardizeMetadata } from "@/common/metadata"
65
import RestrictedRoute from "@/components/RestrictedRoute/RestrictedRoute"

frontends/main/src/app/types.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export type SearchParams = {
2+
[key: string]: string | string[] | undefined
3+
}
4+
5+
export type PageParams<RouteParams = Record<string, never>> = {
6+
params?: Promise<RouteParams>
7+
searchParams?: Promise<SearchParams>
8+
}

0 commit comments

Comments
 (0)