Whenever a user refreshes the app, it redirects the user back to the login page because that page was set as the start up form and the URL doesn’t change based on where the user landed. I was wondering if there’s a solution to this problem? Thanks.
What I’ve tried and what’s not working:
Code Sample:
# this is a formatted code snippet.
# paste your code between ```
The short answer is to use the routing functionality of Anvil Extras. That will give you a URL for each form, and allow refreshing to start back on that form. GitHub - anvilistas/anvil-extras
Maybe another answer is to look at startup modules rather than startup forms
See docs on when your app starts
You can define a startup module with the following code:
import anvil.users
from anvil import open_form
def startup():
if anvil.users.get_user() is not None:
open_form("Dashboard")
else:
open_form("Login")
if __name__ == "__main__":
startup()