'use client'

import { useEffect, useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
import QGrid from '@/components/grid/QGrid'

export default function GridPage() {
  const { get } = useAxios()

  const [gridProps, setGridProps] = useState({
    gridData: [],
    isPageable: false,
  })

  useEffect(() => {
    async function fetchData() {
      // const response = await fetch('https://www.ag-grid.com/example-assets/space-mission-data.json')
      // const data = await response.json()
      const data = await get({ url: 'https://www.ag-grid.com/example-assets/space-mission-data.json' })
      setGridProps({ ...gridProps, gridData: data })
    }
    fetchData()
  }, [])

  return <QGrid {...gridProps} />
}
