From dba34806e69cd4abc3891534dbf05ddf04c8cf01 Mon Sep 17 00:00:00 2001 From: BSanchidrian Date: Wed, 6 Nov 2024 14:24:05 +0100 Subject: [PATCH] fix bug --- src/app/solicitar-ayuda/page.js | 6 +++--- src/components/OfferHelp.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/solicitar-ayuda/page.js b/src/app/solicitar-ayuda/page.js index f9a3c6ef..d075a07d 100644 --- a/src/app/solicitar-ayuda/page.js +++ b/src/app/solicitar-ayuda/page.js @@ -18,7 +18,7 @@ export default function SolicitarAyuda() { const router = useRouter(); const session = useSession(); const [formData, setFormData] = useState({ - nombre: session.user.user_metadata.full_name || '', + nombre: session?.user?.user_metadata?.full_name || '', ubicacion: '', coordinates: null, tiposAyuda: [], @@ -26,10 +26,10 @@ export default function SolicitarAyuda() { descripcion: '', urgencia: 'alta', situacionEspecial: '', - contacto: session.user.user_metadata.telefono || '', + contacto: session?.user?.user_metadata?.telefono || '', consentimiento: false, pueblo: '', - email: session.user.user_metadata.email || '', + email: session?.user?.user_metadata?.email || '', }); const [status, setStatus] = useState({ diff --git a/src/components/OfferHelp.js b/src/components/OfferHelp.js index e7613323..f003e7aa 100644 --- a/src/components/OfferHelp.js +++ b/src/components/OfferHelp.js @@ -30,9 +30,9 @@ export default function OfferHelp({ const router = useRouter(); const [formData, setFormData] = useState({ - nombre: data.name || session.user.user_metadata.full_name || '', - telefono: data.contact_info || session.user.user_metadata.telefono || '', - email: data.additional_info?.email || session.user.user_metadata.email || '', + nombre: data.name || session?.user?.user_metadata?.full_name || '', + telefono: data.contact_info || session?.user?.user_metadata?.telefono || '', + email: data.additional_info?.email || session?.user?.user_metadata?.email || '', ubicacion: data.location || '', tiposAyuda: data.help_type || [], vehiculo: data.resources?.vehicle || '',