File tree Expand file tree Collapse file tree 3 files changed +37
-19
lines changed
mocks/fixtures/registry_v0_1_servers Expand file tree Collapse file tree 3 files changed +37
-19
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,6 +12,24 @@ export default async function Home() {
1212 redirect ( "/signin" ) ;
1313 }
1414
15+ // Try to load servers list from the registry API.
16+ // In dev, this may fail if no backend is running; tests use MSW.
17+ let serversSummary : { count : number ; titles : string [ ] } | null = null ;
18+ try {
19+ const res = await fetch ( "http://localhost/registry/v0.1/servers" ) ;
20+ if ( res . ok ) {
21+ const data = ( await res . json ( ) ) as any ;
22+ const items = Array . isArray ( data ?. servers ) ? data . servers : [ ] ;
23+ const titles = items
24+ . map ( ( it : any ) => it ?. server ?. title || it ?. server ?. name )
25+ . filter ( Boolean )
26+ . slice ( 0 , 5 ) ;
27+ serversSummary = { count : items . length , titles } ;
28+ }
29+ } catch {
30+ // ignore; likely no backend in dev
31+ }
32+
1533 return (
1634 < div className = "flex min-h-screen items-center justify-center bg-zinc-50 dark:bg-black" >
1735 < main className = "flex flex-col items-center gap-8 p-8" >
@@ -30,6 +48,24 @@ export default async function Home() {
3048 >
3149 Go to Catalog
3250 </ Link >
51+
52+ < div className = "mt-6 text-sm text-zinc-600 dark:text-zinc-400" >
53+ { serversSummary ? (
54+ < >
55+ < div >
56+ Registry servers available:{ " " }
57+ < strong > { serversSummary . count } </ strong >
58+ </ div >
59+ { serversSummary . titles . length > 0 && (
60+ < div > Sample: { serversSummary . titles . join ( ", " ) } </ div >
61+ ) }
62+ </ >
63+ ) : (
64+ < div className = "italic" >
65+ Registry unavailable in dev (expected)
66+ </ div >
67+ ) }
68+ </ div >
3369 </ div >
3470 </ main >
3571 </ div >
Original file line number Diff line number Diff line change 1+ export default { } ;
You can’t perform that action at this time.
0 commit comments