import { useParams } from '@/router'
import { useSubscriptionContext } from '@inject/graphql/context/SubscriptionContext'
import { useEffect } from 'react'
import { Outlet } from 'react-router-dom'

const Layout = () => {
  const { teamId } = useParams('/trainee/:exerciseId/:teamId')
  const { subscribeTeam } = useSubscriptionContext()
  useEffect(() => subscribeTeam([teamId]), [teamId, subscribeTeam])

  return <Outlet />
}

export default Layout
