Page Reload clears Global/Datastorage Variables

Greetings, I'm new to and just trying to get my feet wet with a few basic concepts. I've built a test app that combines aspects of the user login/register and ToDo apps tutorials in Ionic with the end goal being able to have an app where users can login and create/view/edit/delete only their own content. With the help of the tutorials and some of the posts on this forum I was able to accomplish this, but am running into an issue if the user reloads a page. The reload appears to clear the Global and dataStorage (standard JS default function in the apps for storing data) variables. This creates issues in the app as I'm using those variables to store the user data that is used to call the server scripts which rely on the user session tokens to only extract that user's data from the database I built in Appery.

Is there a way to either prevent the global/dataStorage variables from being cleared when a page is reload and/or a better way to track and pass the user data to the server scripts?

Below are screen shots from my test app. I created a basic Welcome page which is called after the user logs in that displays the users ID and email. In the screen shots below you can see that after the page is reloaded the user data is cleared:

Before Refresh

After Refresh

For reference I’m including some additional screen shots of the backend setup of the app pages. Again the issue with the user variable being cleared out is I use that field to also send the user information to server scripts to obtain the session token so only that user's data is correctly retrieved from the Appery databases.

Model settings – created global user variable to store user values.

Index page scope settings – Populate a user value on the Index page based on the data in the dataStorage JS function which is populated during the login process.

Welcome page scope settings – Populate the global user variable from the dataStorage function when Welcome page loads. On a side note, not sure why you have to populate the user variable again on the Welcome page load, would have expected this to stay populated from the Index page action above, but found if I didn’t repopulated via the dataStorage on the Welcome page load, the user variables were blank.

Welcome page design settings – The user variables are referenced in two list items on the page.

Curious if anyone else is running into this issue and/or has any thoughts on how best to get around it.

1 person has
this question