How does vue.js manage a user's login status?

< H1 > problem description < / H1 >

for a practice project using vue.js, there is such a business scenario: if the user has logged in, the number of days in which the user has logged in is displayed; otherwise, the user is reminded to log in.

my idea is to initiate an AJAX request in the created life cycle hook function of the root component of the application, get the user"s login status, and save it using vuex (for example, setting isLogin to true ). Where you need to determine the login status later, read the data directly from the vuex.

I would like to ask, how should I correctly manage the login status information of users when using vue.js?

Dec.01,2021

what you said is that if you don't log in instead of jumping to the login page, it will show how many days you log in if you don't jump to the login page but click a box to remind the user to log in.
then this is the basis for your login for several consecutive days or how to calculate it. This is what you worry about
. Also, if you have not logged in, you still don't know locally, ah, to see which information values userName password exist
you should go backstage to get the login information for a few days

Menu