-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello!
I've encountered an issue with this hook. I need to conditionally redirect to another route depending on result of polling. It doesn't stop polling after redirect is done.
Here is example of code:
`
const history = useHistory();
const checkPaymentStatus = () => {
return callApi("GET", "/payStatus");
};
const pollingOptions = {
fetchFunc: checkPaymentStatus,
initialState: 1,
delay: 1000,
};
const status = useAPIPolling(pollingOptions);
if (status === 4) {
history.push("/");
}
if (status === 2) {
history.push("/thankyou");
}
`
Any ideas why it happens and how to fix it? btw thank you for this package, it would be great time-saver if not this issue.
Metadata
Metadata
Assignees
Labels
No labels