Good Morning, I am using ReactJs and the Auth0 API. I make a GET call which gets a password change URL generated by the API and then redirects the user to that URL. Once Redirected if I hit the back button the browser it just keeps redirecting me until the URL expires. I am using react-router-dom. The redirect should only happen once.
async function fetchPasswordURL() {
const fetchURL = `http://localhost:8080/redirect`;
const fetchConfig = {
method: 'get',
url: fetchURL,
};
const testResponse = await axios(fetchConfig);
// If the response from the server is a url that is not an empty string then it runs the redirect
if(testResponse.data != '') {
// redirects to URL from server
window.location.href = testResponse.data;
} else {
fetchPasswordURL()
}
}