From f4bd0e7a097a57dc911e55211f69b6409c864c81 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Fri, 12 Jul 2024 14:08:30 -0400 Subject: [PATCH] Added check to error details --- Client/src/Pages/Login/index.jsx | 5 ++++- Client/src/Pages/Register/index.jsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Client/src/Pages/Login/index.jsx b/Client/src/Pages/Login/index.jsx index cd96ea9bd..85d1c8664 100644 --- a/Client/src/Pages/Login/index.jsx +++ b/Client/src/Pages/Login/index.jsx @@ -78,7 +78,10 @@ const Login = () => { // validation errors createToast({ variant: "info", - body: error.details[0].message, + body: + error && error.details && error.details.length > 0 + ? error.details[0].message + : "Error validating data.", hasIcon: false, }); } else if (error.response) { diff --git a/Client/src/Pages/Register/index.jsx b/Client/src/Pages/Register/index.jsx index 098c00bf0..8ca92d5d8 100644 --- a/Client/src/Pages/Register/index.jsx +++ b/Client/src/Pages/Register/index.jsx @@ -95,7 +95,10 @@ const Register = () => { // validation errors createToast({ variant: "info", - body: error.details[0].message, + body: + error && error.details && error.details.length > 0 + ? error.details[0].message + : "Error validating data.", hasIcon: false, }); } else if (error.response) {