Added dependency array and catch block

This commit is contained in:
Alex Holliday
2024-07-02 15:57:53 -07:00
parent 299dadd24d
commit 033101c884

View File

@@ -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, {