Lately, I’ve encountered an issue with data storage in a single-page application.
I’m seeking some guidance on how to effectively store data and retain it after refreshing the page within a Single Page Application.
As an example, let's say I have a 'user name' displayed on the navigation bar, but once I refresh the page, the 'user name' disappears. This 'user name' is stored as a JavaScript variable.
Before Refresh:
https://i.sstatic.net/TfrZa.jpg
After Refresh:
https://i.sstatic.net/dUwUK.jpg
Any suggestions on where and how to securely store this data?
Should I use localStorage or perhaps another method? What is considered the standard or proper approach?
Alternatively, fetching the data from the server every time post-refresh - would that be an appropriate solution?
By the way, I am utilizing Vue.js.
Thank you