Update get supervisors request

This commit is contained in:
adam-skowronek 2022-11-24 18:44:43 +01:00
parent 5c2e5dcba3
commit dd116962e6

View File

@ -3,6 +3,7 @@ import { useState } from 'react'
import { Controller, NestedValue, useForm } from 'react-hook-form'
import { useMutation, useQuery } from 'react-query'
import Select from 'react-select'
import useLocalStorageState from 'use-local-storage-state'
import { getLeaders } from '../../api/leaders'
import { assignSupervisor } from '../../api/schedule'
@ -28,10 +29,11 @@ const EditSchedule = ({
members_of_committee: NestedValue<any[]>
}>({ mode: 'onBlur' })
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { isLoading: areLeadersLoading } = useQuery(
'leaders',
() => getLeaders({ per_page: 1000 }),
() => getLeaders({ year_group_id: Number(yearGroupId), per_page: 1000 }),
{
onSuccess: (data) => {
setCommitteeOptions(