Added dependency array and catch block

This commit is contained in:
Alex Holliday committed 2024-07-02 15:57:53 -07:00
1 parent 299dadd24d
commit 033101c884
1 file changed
+11 -6
+11 -6
View File
@@ -40,12 +40,17 @@ const Register = () => {
}); });
useEffect(() => { useEffect(() => {
axios.get(BASE_URL + "/auth/users/admin").then((response) => { axios
if (response.data.data === true) { .get(BASE_URL + "/auth/users/admin")
navigate("/login"); .then((response) => {
} if (response.data.data === true) {
}); navigate("/login");
}); }
})
.catch((error) => {
console.log(error);
});
}, [navigate]);
useEffect(() => { useEffect(() => {
const { error } = registerValidation.validate(form, { const { error } = registerValidation.validate(form, {