fix: On ne peut sélectionner que les élèves inscrits [#16]

This commit is contained in:
N3WT DE COMPET
2025-05-20 18:50:19 +02:00
parent 4f40d1f29d
commit 56c223f3cc
3 changed files with 20 additions and 7 deletions

View File

@ -128,10 +128,16 @@ export const archiveRegisterForm = (id) => {
.catch(errorHandler);
};
export const fetchStudents = (establishment, id = null) => {
const url = id
? `${BE_SUBSCRIPTION_STUDENTS_URL}/${id}`
: `${BE_SUBSCRIPTION_STUDENTS_URL}?establishment_id=${establishment}`;
export const fetchStudents = (establishment, id = null, status = null) => {
let url;
if (id) {
url = `${BE_SUBSCRIPTION_STUDENTS_URL}/${id}`;
} else {
url = `${BE_SUBSCRIPTION_STUDENTS_URL}?establishment_id=${establishment}`;
if (status) {
url += `&status=${status}`;
}
}
const request = new Request(url, {
method: 'GET',
headers: {