From 033101c8840f4fc78310426d2063c8a93a40cff4 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 2 Jul 2024 15:57:53 -0700 Subject: [PATCH] Added dependency array and catch block --- Client/src/Pages/Register/index.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Client/src/Pages/Register/index.jsx b/Client/src/Pages/Register/index.jsx index 709f46ca9..4aaf5afc8 100644 --- a/Client/src/Pages/Register/index.jsx +++ b/Client/src/Pages/Register/index.jsx @@ -40,12 +40,17 @@ const Register = () => { }); useEffect(() => { - axios.get(BASE_URL + "/auth/users/admin").then((response) => { - if (response.data.data === true) { - navigate("/login"); - } - }); - }); + axios + .get(BASE_URL + "/auth/users/admin") + .then((response) => { + if (response.data.data === true) { + navigate("/login"); + } + }) + .catch((error) => { + console.log(error); + }); + }, [navigate]); useEffect(() => { const { error } = registerValidation.validate(form, {