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(() => {
|
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, {
|
||||||
|
|||||||
Reference in new issue
Block a user