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) {