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?