mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-04 04:01:27 +00:00
refactor: changement de la philosophie de logging
This commit is contained in:
@ -23,9 +23,8 @@ import { createDatas,
|
||||
fetchTuitionPaymentModes } from '@/app/actions/schoolAction';
|
||||
import SidebarTabs from '@/components/SidebarTabs';
|
||||
import FilesManagement from '@/components/Structure/Files/FilesManagement';
|
||||
|
||||
import { fetchRegisterFormFileTemplate } from '@/app/actions/subscriptionAction';
|
||||
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
|
||||
export default function Page() {
|
||||
@ -75,7 +74,7 @@ export default function Page() {
|
||||
.then((data)=> {
|
||||
setFichiers(data)
|
||||
})
|
||||
.catch(error => console.error('Error fetching files:', error));
|
||||
.catch(error => logger.error('Error fetching files:', error));
|
||||
|
||||
// Fetch data for registration payment plans
|
||||
handleRegistrationPaymentPlans();
|
||||
@ -95,7 +94,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setSpecialities(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching specialities:', error));
|
||||
.catch(error => logger.error('Error fetching specialities:', error));
|
||||
};
|
||||
|
||||
const handleTeachers = () => {
|
||||
@ -103,7 +102,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setTeachers(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching teachers:', error));
|
||||
.catch(error => logger.error('Error fetching teachers:', error));
|
||||
};
|
||||
|
||||
const handleClasses = () => {
|
||||
@ -111,7 +110,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setClasses(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching classes:', error));
|
||||
.catch(error => logger.error('Error fetching classes:', error));
|
||||
};
|
||||
|
||||
const handleSchedules = () => {
|
||||
@ -119,7 +118,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setSchedules(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching schedules:', error));
|
||||
.catch(error => logger.error('Error fetching schedules:', error));
|
||||
};
|
||||
|
||||
const handleRegistrationDiscounts = () => {
|
||||
@ -127,7 +126,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setRegistrationDiscounts(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching registration discounts:', error));
|
||||
.catch(error => logger.error('Error fetching registration discounts:', error));
|
||||
};
|
||||
|
||||
const handleTuitionDiscounts = () => {
|
||||
@ -135,7 +134,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setTuitionDiscounts(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching tuition discounts:', error));
|
||||
.catch(error => logger.error('Error fetching tuition discounts:', error));
|
||||
};
|
||||
|
||||
const handleRegistrationFees = () => {
|
||||
@ -143,7 +142,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setRegistrationFees(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching registration fees:', error));
|
||||
.catch(error => logger.error('Error fetching registration fees:', error));
|
||||
};
|
||||
|
||||
const handleTuitionFees = () => {
|
||||
@ -151,7 +150,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setTuitionFees(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching tuition fees', error));
|
||||
.catch(error => logger.error('Error fetching tuition fees', error));
|
||||
};
|
||||
|
||||
const handleRegistrationPaymentPlans = () => {
|
||||
@ -159,7 +158,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setRegistrationPaymentPlans(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching registration payment plans:', error));
|
||||
.catch(error => logger.error('Error fetching registration payment plans:', error));
|
||||
};
|
||||
|
||||
const handleTuitionPaymentPlans = () => {
|
||||
@ -167,7 +166,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setTuitionPaymentPlans(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching tuition payment plans:', error));
|
||||
.catch(error => logger.error('Error fetching tuition payment plans:', error));
|
||||
};
|
||||
|
||||
const handleRegistrationPaymentModes = () => {
|
||||
@ -175,7 +174,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setRegistrationPaymentModes(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching registration payment modes:', error));
|
||||
.catch(error => logger.error('Error fetching registration payment modes:', error));
|
||||
};
|
||||
|
||||
const handleTuitionPaymentModes = () => {
|
||||
@ -183,7 +182,7 @@ export default function Page() {
|
||||
.then(data => {
|
||||
setTuitionPaymentModes(data);
|
||||
})
|
||||
.catch(error => console.error('Error fetching tuition payment modes:', error));
|
||||
.catch(error => logger.error('Error fetching tuition payment modes:', error));
|
||||
};
|
||||
|
||||
const handleCreate = (url, newData, setDatas) => {
|
||||
@ -193,7 +192,7 @@ export default function Page() {
|
||||
return data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error creating data:', error);
|
||||
logger.error('Error creating data:', error);
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
@ -205,7 +204,7 @@ export default function Page() {
|
||||
return data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error editing data:', error);
|
||||
logger.error('Error editing data:', error);
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
@ -217,7 +216,7 @@ export default function Page() {
|
||||
return data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error deleting data:', error);
|
||||
logger.error('Error deleting data:', error);
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
@ -234,11 +233,11 @@ export default function Page() {
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Planning mis à jour avec succès :', data);
|
||||
logger.debug('Planning mis à jour avec succès :', data);
|
||||
//setDatas(data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erreur :', error);
|
||||
logger.error('Erreur :', error);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user