const confirmExit = (e) => {
let dialogText = 'You have unsaved changes. If you leave this page all changes will be lost. Do you wish to continue?';
e.returnValue = dialogText;
return dialogText;
}
window.onbeforeunload = confirmExit;
How to add a condition once the user confirmed the reload option so that i can route to the root page of the app?
before: http://localhost:9000/test
After the user confirmed the refresh button: http://localhost:9000/