@@ -24,8 +24,11 @@ export default async function ReposPage({
2424 const { language } = await params ;
2525 const sp = await searchParams ;
2626
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 ;
2932
3033 return (
3134 < >
@@ -75,7 +78,7 @@ export async function generateMetadata({
7578async function getRepos (
7679 language : string ,
7780 searchParams : SearchParams
78- ) : Promise < RepoResponse > {
81+ ) : Promise < RepoResponse | undefined > {
7982 const client = getXataClient ( ) ;
8083 const session = await auth ( ) ;
8184 const {
@@ -127,8 +130,8 @@ async function getRepos(
127130 }
128131
129132 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 ;
132135
133136 const repos = ( await res . json ( ) ) as RepoData ;
134137 const reports = await getReportedRepos ( ) ;
@@ -137,7 +140,7 @@ async function getRepos(
137140 return ! repo . archived && ! reports . find ( report => report . repoId === repo . id ) ;
138141 } ) ;
139142
140- if ( ! Array . isArray ( repos . items ) || repos . items ?. length < 1 ) notFound ( ) ;
143+ if ( ! Array . isArray ( repos . items ) || repos . items ?. length < 1 ) return undefined ;
141144
142145 return {
143146 page : + page . toString ( ) ,
0 commit comments