Update get supervisors request
This commit is contained in:
parent
5c2e5dcba3
commit
dd116962e6
@ -3,6 +3,7 @@ import { useState } from 'react'
|
|||||||
import { Controller, NestedValue, useForm } from 'react-hook-form'
|
import { Controller, NestedValue, useForm } from 'react-hook-form'
|
||||||
import { useMutation, useQuery } from 'react-query'
|
import { useMutation, useQuery } from 'react-query'
|
||||||
import Select from 'react-select'
|
import Select from 'react-select'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
import { getLeaders } from '../../api/leaders'
|
import { getLeaders } from '../../api/leaders'
|
||||||
import { assignSupervisor } from '../../api/schedule'
|
import { assignSupervisor } from '../../api/schedule'
|
||||||
|
|
||||||
@ -28,10 +29,11 @@ const EditSchedule = ({
|
|||||||
members_of_committee: NestedValue<any[]>
|
members_of_committee: NestedValue<any[]>
|
||||||
}>({ mode: 'onBlur' })
|
}>({ mode: 'onBlur' })
|
||||||
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
|
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const { isLoading: areLeadersLoading } = useQuery(
|
const { isLoading: areLeadersLoading } = useQuery(
|
||||||
'leaders',
|
'leaders',
|
||||||
() => getLeaders({ per_page: 1000 }),
|
() => getLeaders({ year_group_id: Number(yearGroupId), per_page: 1000 }),
|
||||||
{
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setCommitteeOptions(
|
setCommitteeOptions(
|
||||||
|
Loading…
Reference in New Issue
Block a user