@@ -4,25 +4,25 @@ import { StatusPageRow } from "@/components/status-pages/StatusPageRow";
44import { BasePage } from "@/components/design-elements" ;
55
66import { useTheme } from "@mui/material/styles" ;
7- import type { IMonitor } from "@/types/monitor" ;
87import { useGet } from "@/hooks/UseApi" ;
98import type { ApiResponse } from "@/types/api" ;
109import { useParams } from "react-router" ;
11- import type { IStatusPageWithMonitors } from "@/types/status-page" ;
10+ import type { IStatusPageWithChecksMap } from "@/types/status-page" ;
1211import { NameHeader } from "@/components/status-pages/NameHeader" ;
1312import { config } from "@/config/index" ;
1413
1514const GLOBAL_REFRESH = config . GLOBAL_REFRESH ;
1615const StatusPages = ( ) => {
1716 const theme = useTheme ( ) ;
1817 const { id } = useParams ( ) ;
19- const { response, loading } = useGet < ApiResponse < IStatusPageWithMonitors > > (
18+ const { response, loading } = useGet < ApiResponse < IStatusPageWithChecksMap > > (
2019 `/status-pages/${ id } ` ,
2120 { } ,
2221 { refreshInterval : GLOBAL_REFRESH , keepPreviousData : true }
2322 ) ;
24- const statusPage = response ?. data ;
25- const monitors : IMonitor [ ] = statusPage ?. monitors || [ ] ;
23+ const statusPage = response ?. data ?. statusPage ;
24+ const monitors = statusPage ?. monitors || [ ] ;
25+ const checksMap : Record < string , any [ ] > = response ?. data ?. checksMap || { } ;
2626
2727 if ( ! statusPage ) {
2828 return null ;
@@ -33,8 +33,15 @@ const StatusPages = () => {
3333 < Stack minWidth = { "66vw" } spacing = { theme . spacing ( 8 ) } >
3434 < NameHeader statusPage = { statusPage } />
3535 < StatusHeader statusPage = { statusPage } />
36- { monitors ?. map ( ( monitor : IMonitor ) => {
37- return < StatusPageRow key = { monitor ?. _id } monitor = { monitor } /> ;
36+ { monitors ?. map ( ( monitor : any ) => {
37+ const checks = checksMap ?. [ monitor ?. _id as any ] || [ ] ;
38+ return (
39+ < StatusPageRow
40+ key = { monitor ?. _id }
41+ monitor = { monitor }
42+ checks = { checks }
43+ />
44+ ) ;
3845 } ) }
3946 </ Stack >
4047 </ BasePage >
0 commit comments