2022-05-30 21:38:45 +02:00
|
|
|
import axiosInstance from './axiosInstance'
|
2022-05-22 21:28:25 +02:00
|
|
|
|
2022-06-08 21:48:49 +02:00
|
|
|
type OrderType = 'asc' | 'desc'
|
|
|
|
|
2022-05-22 21:28:25 +02:00
|
|
|
interface StudentResponse {
|
2022-05-30 21:38:45 +02:00
|
|
|
max_pages: number
|
2022-06-04 21:03:40 +02:00
|
|
|
students: Student[]
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Student {
|
|
|
|
first_name: string
|
|
|
|
last_name: string
|
|
|
|
index: number
|
2022-06-12 18:31:01 +02:00
|
|
|
pesel: string
|
2022-06-04 21:03:40 +02:00
|
|
|
mode: boolean
|
|
|
|
group?: any
|
2022-05-22 21:28:25 +02:00
|
|
|
}
|
|
|
|
|
2022-06-08 21:48:49 +02:00
|
|
|
export const getStudents = (
|
|
|
|
params: Partial<{
|
|
|
|
fullname: string
|
|
|
|
order_by_first_name: OrderType
|
|
|
|
order_by_last_name: OrderType
|
|
|
|
page: number
|
|
|
|
per_page: number
|
2022-06-11 15:06:17 +02:00
|
|
|
mode: boolean
|
2022-06-08 21:48:49 +02:00
|
|
|
}> = {},
|
|
|
|
) =>
|
2022-05-30 21:38:45 +02:00
|
|
|
axiosInstance.get<StudentResponse>(
|
|
|
|
'http://127.0.0.1:5000/api/coordinator/students',
|
2022-06-08 21:48:49 +02:00
|
|
|
{ params },
|
2022-05-30 21:38:45 +02:00
|
|
|
)
|
|
|
|
|
2022-06-04 21:03:40 +02:00
|
|
|
export const createStudent = (payload: Student) =>
|
|
|
|
axiosInstance.post('http://127.0.0.1:5000/api/coordinator/students/', payload)
|
|
|
|
|
2022-06-12 19:01:16 +02:00
|
|
|
export const uploadStudents = (payload: FormData, mode: Boolean) =>
|
2022-05-30 21:38:45 +02:00
|
|
|
axiosInstance.post(
|
|
|
|
'http://127.0.0.1:5000/api/coordinator/students/upload/',
|
|
|
|
payload,
|
2022-06-12 19:01:16 +02:00
|
|
|
mode,
|
2022-05-30 21:38:45 +02:00
|
|
|
)
|