fix: enhance toast notifications for form submission feedback
This commit is contained in:
@@ -277,10 +277,42 @@ export default function FormularioRegistro({
|
||||
'/cuestionario-respondido/submit',
|
||||
payload
|
||||
);
|
||||
toast.success(res.data.message || 'Formulario enviado correctamente');
|
||||
toast(
|
||||
(t) => (
|
||||
<span
|
||||
className="fs-4 pc-3 py-2"
|
||||
style={{
|
||||
maxWidth: '400px',
|
||||
wordWrap: 'break-word',
|
||||
whiteSpace: 'normal',
|
||||
}}
|
||||
>
|
||||
{res.data.message.includes('ya ha respondido') ? (
|
||||
<>
|
||||
<i className="bi bi-exclamation-circle-fill text-warning me-2"></i>
|
||||
{res.data.message}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<i className="bi bi-check-circle-fill text-success me-2"></i>
|
||||
{res.data.message || '¡Formulario enviado!'}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
{
|
||||
duration: 6000,
|
||||
position: 'bottom-center',
|
||||
style: {
|
||||
maxWidth: '425px',
|
||||
},
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(getAxiosError(error));
|
||||
toast.error('Hubo un error al enviar el formulario');
|
||||
toast.error('Hubo un error al enviar el formulario', {
|
||||
duration: 5000,
|
||||
});
|
||||
} finally {
|
||||
// Redirigir al usuario después de enviar el formulario
|
||||
router.push('/');
|
||||
@@ -365,7 +397,7 @@ export default function FormularioRegistro({
|
||||
? 'Ingrese su RFC sin homoclave'
|
||||
: preguntaCuenta?.validacion === 'cuenta_trabajador'
|
||||
? 'Ingrese su numero de trabajador'
|
||||
: 'Ingrese su ' + preguntaCuenta.pregunta
|
||||
: 'Ingrese su ' + preguntaCuenta.pregunta
|
||||
}
|
||||
maxLength={10}
|
||||
value={respuestas[preguntaCuenta.id_pregunta] || ''}
|
||||
|
||||
Reference in New Issue
Block a user