Couldn't run async function in routers, Framework7 Core

Hi, I’m using Framework7 Core and I have no idea how to make a proper login screen

So here’s the basic logic that I use, if username and password matches what in the database, it then saves to localStorage as either true and false.

What’s the problem? I couldn’t find a way to properly check the login status if the user decided to run the app back again. What I am trying to do is that when the user runs the app back, it then checks the localStorage whether it’s true or false (it won’t be the most secure thing ever but I just need it to be as simple as possible to just show the gist of the app for educational purposes). I tried to use just some basic document.on(“click”) script and it looks off because it flickers the root page first then going back to the intended page. After some reading, I tried using async inside the routes.js and it couldn’t read that at all and instead just showing me a blank page.

Note: index.html contains empty page with a left panel, while login.html and mainmenu.html contains things that you might expect from a page named as such.