fix: Correction sur le calcul du nombre total de pages [#1]

This commit is contained in:
N3WT DE COMPET
2024-11-24 15:30:30 +01:00
parent a77dd8ec64
commit 5946cbdee6

View File

@ -88,7 +88,7 @@ export default function Page({ params: { locale } }) {
if (ficheInscriptions) {
setFichesInscriptionsDataEnCours(fichesInscriptions);
}
const calculatedTotalPages = Math.ceil(count / pageSize);
const calculatedTotalPages = count === 0 ? 1 : Math.ceil(count / pageSize);
setTotalPending(count);
setTotalPages(calculatedTotalPages);
}
@ -304,10 +304,10 @@ export default function Page({ params: { locale } }) {
.then(data => {
console.log('Success:', data);
setFichesInscriptionsDataEnCours(prevState => {
if (prevState && prevState.length > 0) {
if (prevState) {
return [...prevState, data];
}
return prevState;
return [data];
});
setTotalPending(totalPending+1);
if (updatedData.autoMail) {