@@ -24,8 +24,11 @@ export default async function ReposPage({
24
24
const { language } = await params ;
25
25
const sp = await searchParams ;
26
26
27
- const key = JSON . stringify ( sp ) ;
28
- const { repos, page } = await getRepos ( language , sp ) ;
27
+ const reposRes = await getRepos ( language , sp ) ;
28
+
29
+ if ( ! reposRes ) notFound ( ) ;
30
+
31
+ const { repos, page } = reposRes ;
29
32
30
33
return (
31
34
< >
@@ -75,7 +78,7 @@ export async function generateMetadata({
75
78
async function getRepos (
76
79
language : string ,
77
80
searchParams : SearchParams
78
- ) : Promise < RepoResponse > {
81
+ ) : Promise < RepoResponse | undefined > {
79
82
const client = getXataClient ( ) ;
80
83
const session = await auth ( ) ;
81
84
const {
@@ -127,8 +130,8 @@ async function getRepos(
127
130
}
128
131
129
132
const res = await fetch ( apiUrl , { headers } ) ;
130
- console . log ( JSON . stringify ( res ) ) ;
131
- if ( ! res . ok ) notFound ( ) ;
133
+ console . log ( res ) ;
134
+ if ( ! res . ok ) return undefined ;
132
135
133
136
const repos = ( await res . json ( ) ) as RepoData ;
134
137
const reports = await getReportedRepos ( ) ;
@@ -137,7 +140,7 @@ async function getRepos(
137
140
return ! repo . archived && ! reports . find ( report => report . repoId === repo . id ) ;
138
141
} ) ;
139
142
140
- if ( ! Array . isArray ( repos . items ) || repos . items ?. length < 1 ) notFound ( ) ;
143
+ if ( ! Array . isArray ( repos . items ) || repos . items ?. length < 1 ) return undefined ;
141
144
142
145
return {
143
146
page : + page . toString ( ) ,
0 commit comments