import { useTrainingsQuery } from '../../gql'
import Link from 'next/link'

const TrainingsList = (props: any) => {
  const { data, error, loading } = useTrainingsQuery()
  console.log(props)

  return (
    <ul>
      {data &&
        data.trainings.map(training => (
          <li key={training.id}>
            <Link href='/training/[id]' as={`/training/${training.id}`}>
              <a>{training.title}</a>
            </Link>
          </li>
        ))}
    </ul>
  )
}

export default TrainingsList
