fix: Correction URL

chore: Ajout de notifications
This commit is contained in:
N3WT DE COMPET
2025-05-30 21:11:47 +02:00
parent ce83e02f7b
commit 170f7c4fa8
5 changed files with 51 additions and 12 deletions

View File

@ -8,9 +8,11 @@ import { useEstablishment } from '@/context/EstablishmentContext';
import { editRegisterForm } from '@/app/actions/subscriptionAction';
import logger from '@/utils/logger';
import Loader from '@/components/Loader';
import { useNotification } from '@/context/NotificationContext';
export default function Page() {
const router = useRouter();
const { showNotification } = useNotification();
const searchParams = useSearchParams();
const studentId = searchParams.get('studentId');
const enable = searchParams.get('enabled') === 'true';
@ -26,11 +28,21 @@ export default function Page() {
.then((result) => {
setIsLoading(false);
logger.debug('Success:', result);
showNotification(
"Dossier d'inscription soumis avec succès",
'success',
'Succès'
);
router.push(FE_ADMIN_SUBSCRIPTIONS_URL);
})
.catch((error) => {
setIsLoading(false);
logger.error('Error:', error.message);
showNotification(
"Erreur lors de la soumission du dossier d'inscription",
'error',
'Erreur'
);
if (error.details) {
logger.error('Form errors:', error.details);
setFormErrors(error.details);