I want to be able to navigate to a sign-in page if the expiry date held local storage variable has expired, or into the main menu if it is still valid. The problem is page navigates to the menu page as expected but immediately returns to the landing page! There is no code to do this on the menu page - how can I stop this happening?
Here is my landing page on-load javascript:
var x = localStorage.getItem("expires");
if (x){
var d2 = new Date(localStorage.getItem("expires"));
var d1 = new Date();
var timeDiff = Math.abs(d2.getTime() - d1.getTime());
if(timeDiff < 0){
Appery.navigateTo('loginPage');
}else{
Appery.navigateTo('Screen2MainMenu');
}
}else{
Appery.navigateTo('loginPage');
}