vinh vuong hung
vinh vuong hung

Reputation: 51

session is null when call API in ssr angular app

ex: if at the home page or other page and then go to the video page, the API return from req.session of nodejs server is correct, but if at the current page I press F5(reload the page, get API before render) the result is null(session is null). So, please help me resolve this problem. Thank you.

Upvotes: 1

Views: 538

Answers (1)

Brn.Rajoriya
Brn.Rajoriya

Reputation: 1544

The Application Architecture is most required here to know, How you are using Node and Angular.

But as you mentioned API is not responding in a proper manner. So the logic you will have to check at Auth Guard.

If you want to work with Reload, Then the session token must be store at the Browser Memory.

API call required the Token to remember the active session. And in your case, You are missing that token somewhere.

Example: https://stackoverflow.com/a/37396572/3851720

Note: On every call, Token must be pass from Browser Storage.

Upvotes: 1

Related Questions