Fix hardcoded year group

This commit is contained in:
adam-skowronek 2022-11-25 11:50:16 +01:00
parent fc3d84aa80
commit 3cc763924e
5 changed files with 20 additions and 5 deletions

View File

@ -60,7 +60,7 @@ export const getAvailabilityForCoordinator = (scheduleId: number) => {
}>(`coordinator/enrollments/${scheduleId}/temporary-availabilities`)
}
export const getSchedules = (year_group_id: number = 1) => {
export const getSchedules = (year_group_id: number) => {
return axiosInstance.get<{
examination_schedules: {
id: number

View File

@ -18,7 +18,7 @@ const Schedules = () => {
const [endDate, setEndDate] = useState(new Date())
const { data: schedules, refetch } = useQuery(['getSchedules'], () =>
getSchedules(),
getSchedules(Number(yearGroupId)),
)
const { mutate: mutateCreateSchedule } = useMutation(

View File

@ -1,9 +1,14 @@
import { useQuery } from 'react-query'
import { getSchedules } from '../../api/schedule'
import { Link } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
const SupervisorAvailabilities = () => {
const { data: schedules } = useQuery(['getSchedules'], () => getSchedules())
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { data: schedules } = useQuery(['getSchedules'], () =>
getSchedules(Number(yearGroupId)),
)
return (
<div>

View File

@ -1,9 +1,14 @@
import { useQuery } from 'react-query'
import { getSchedules } from '../../api/schedule'
import { Link } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
const StudentSchedules = () => {
const { data: schedules } = useQuery(['getSchedules'], () => getSchedules())
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { data: schedules } = useQuery(['getSchedules'], () =>
getSchedules(Number(yearGroupId)),
)
return (
<div>

View File

@ -1,9 +1,14 @@
import { useQuery } from 'react-query'
import { getSchedules } from '../../api/schedule'
import { Link } from 'react-router-dom'
import useLocalStorageState from 'use-local-storage-state'
const SupervisorSchedules = () => {
const { data: schedules } = useQuery(['getSchedules'], () => getSchedules())
const [yearGroupId] = useLocalStorageState('yearGroupId')
const { data: schedules } = useQuery(['getSchedules'], () =>
getSchedules(Number(yearGroupId)),
)
return (
<div>