You use ajax to access an interface for checking login on the server, and then get the user information by the way, save the user information in a rootscope variable, and then judge this variable in the template to display please log in, or user name, avatar, etc. information. This is basically the idea.
If the front-end and back-end are separated, the backend will definitely provide you with relevant interfaces. You can store the user session identifier returned by the backend, such as token, when the login is successful, and verify whether the token is used when doing other related interactions with the backend. Expiration, whether there are permissions, etc., seal the verification function into the service for public use.
You use ajax to access an interface for checking login on the server, and then get the user information by the way, save the user information in a rootscope variable, and then judge this variable in the template to display please log in, or user name, avatar, etc. information. This is basically the idea.
If the front-end and back-end are separated, the backend will definitely provide you with relevant interfaces. You can store the user session identifier returned by the backend, such as token, when the login is successful, and verify whether the token is used when doing other related interactions with the backend. Expiration, whether there are permissions, etc., seal the verification function into the service for public use.