@@ -8,25 +8,17 @@ import { Spinner } from "@/shared/components/ui/spinner";
88import usePagination from "@/shared/hooks/usePagination" ;
99import useSearch from "@/shared/hooks/useSearch" ;
1010import { useEvents } from "../api/get-events.query" ;
11- import { INFRAHUB_EVENT } from "../utils/constants" ;
12- import { EventType } from "./event" ;
1311import { Event } from "./global-event" ;
1412
1513export const GlobalEvents = ( ) => {
1614 const [ pagination ] = usePagination ( ) ;
1715 const [ search ] = useSearch ( ) ;
18- const { isLoading, data, error, refetch } = useEvents ( { ...pagination , search } ) ;
16+ const { isLoading, data, count , error, refetch } = useEvents ( { ...pagination , search } ) ;
1917
2018 if ( error ) {
2119 return < ErrorFallback error = { error } /> ;
2220 }
2321
24- const activities : EventType [ ] = data ?. data ?. [ INFRAHUB_EVENT ] ?. edges ?. map ( ( edge ) => {
25- return edge . node ;
26- } ) ;
27-
28- const count = data ?. data ?. [ INFRAHUB_EVENT ] ?. count ;
29-
3022 return (
3123 < Content . Card >
3224 < Content . CardTitle
@@ -43,9 +35,9 @@ export const GlobalEvents = () => {
4335 </ div >
4436
4537 < div className = "flex flex-col gap-2" >
46- { ! isLoading && ! activities ?. length && < NoDataFound message = "No activity found." /> }
38+ { ! isLoading && ! data ?. length && < NoDataFound message = "No activity found." /> }
4739
48- { activities ?. map ( ( activity ) => (
40+ { data ?. map ( ( activity ) => (
4941 < Event key = { activity . id } { ...activity } />
5042 ) ) }
5143 </ div >
0 commit comments