I am having a ts file in which I have written a function to logout which is :
private addListenersForLogout() {
if (this._logoutDiv) {
this._logoutDiv.addEventListener("click", (e) => {
DataManager.getDataManager().geHttpDataHandler().postRequest("", HTMLFactory.POST_USER_LOGOUT, () => {
window.location.href = Constants.LOGIN;
}, () => {
Console.log("Failed");
})
})
}
}
Here , this._logoutDiv is a div element on which I am adding click listener . When the user clicks it one backend API is called and based upon the response I am redirecting to the login page . But as soon as I am clicking it and after I get the response from the backend it shows an alert box of Leave Site . How can I remove that ?? or Is there any alternative to window.location.href to redirect ??
Here is the screenshot of the alert message .

Thanks