chore: Application du linter

This commit is contained in:
Luc SORIGNET
2025-05-12 10:34:47 +02:00
parent 23a593dbc7
commit 425e6d73e5
56 changed files with 1140 additions and 1469 deletions

View File

@ -7,19 +7,7 @@ import {
} from '@/utils/Url';
import { CURRENT_YEAR_FILTER } from '@/utils/constants';
import { useNotification } from '@/context/NotificationContext';
const requestResponseHandler = async (response) => {
const body = await response.json();
if (response.ok) {
return body;
}
// Throw an error with the JSON body containing the form errors
const error = new Error(body?.errorMessage || 'Une erreur est survenue');
error.details = body;
showNotification('Une erreur inattendue est survenue.', 'error', 'Erreur');
throw error;
};
import { errorHandler, requestResponseHandler } from './actionsHandlers';
export const fetchRegisterForms = (
establishment,
@ -36,17 +24,20 @@ export const fetchRegisterForms = (
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const fetchRegisterForm = (id) => {
return fetch(`${BE_SUBSCRIPTION_REGISTERFORMS_URL}/${id}`) // Utilisation de studentId au lieu de codeDI
.then(requestResponseHandler);
.then(requestResponseHandler)
.catch(errorHandler);
};
export const fetchLastGuardian = () => {
return fetch(`${BE_SUBSCRIPTION_LAST_GUARDIAN_ID_URL}`).then(
requestResponseHandler
);
return fetch(`${BE_SUBSCRIPTION_LAST_GUARDIAN_ID_URL}`)
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editRegisterForm = (id, data, csrfToken) => {
@ -57,7 +48,9 @@ export const editRegisterForm = (id, data, csrfToken) => {
},
body: data,
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const createRegisterForm = (data, csrfToken) => {
@ -70,7 +63,9 @@ export const createRegisterForm = (data, csrfToken) => {
},
body: JSON.stringify(data),
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const sendRegisterForm = (id) => {
@ -79,7 +74,9 @@ export const sendRegisterForm = (id) => {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const resendRegisterForm = (id) => {
@ -88,7 +85,9 @@ export const resendRegisterForm = (id) => {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const archiveRegisterForm = (id) => {
const url = `${BE_SUBSCRIPTION_REGISTERFORMS_URL}/${id}/archive`;
@ -97,7 +96,9 @@ export const archiveRegisterForm = (id) => {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const fetchStudents = (establishment, id = null) => {
@ -110,7 +111,7 @@ export const fetchStudents = (establishment, id = null) => {
'Content-Type': 'application/json',
},
});
return fetch(request).then(requestResponseHandler);
return fetch(request).then(requestResponseHandler).catch(errorHandler);
};
export const fetchChildren = (id, establishment) => {
@ -123,7 +124,7 @@ export const fetchChildren = (id, establishment) => {
},
}
);
return fetch(request).then(requestResponseHandler);
return fetch(request).then(requestResponseHandler).catch(errorHandler);
};
export async function getRegisterFormFileTemplate(fileId) {
@ -206,7 +207,9 @@ export const dissociateGuardian = async (studentId, guardianId) => {
export const fetchAbsences = (establishment) => {
return fetch(
`${BE_SUBSCRIPTION_ABSENCES_URL}?establishment_id=${establishment}`
).then(requestResponseHandler);
)
.then(requestResponseHandler)
.catch(errorHandler);
};
export const createAbsences = (data, csrfToken) => {
@ -218,7 +221,9 @@ export const createAbsences = (data, csrfToken) => {
'Content-Type': 'application/json',
},
credentials: 'include',
}).then(requestResponseHandler);
})
.then(requestResponseHandler)
.catch(errorHandler);
};
export const editAbsences = (absenceId, payload, csrfToken) => {