import { useAuthIdentity } from '@inject/graphql/auth'
import CenteredSpinner from '@inject/shared/components/CenteredSpinner'
import Staff from './staff'
import Trainee from './trainee'

const Index = () => {
  const { loading, isStaff, isSuperuser } = useAuthIdentity()

  if (loading) {
    return <CenteredSpinner />
  }
  if (isStaff || isSuperuser) {
    return <Staff />
  } else {
    return <Trainee />
  }
}

export default Index
