Added dependency array and catch block
This commit is contained in:
1 parent
299dadd24d
commit
033101c884
1 file changed
+11
-6
@@ -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, {
|
||||
|
||||
Reference in new issue
Block a user