Answer the question
In order to leave comments, you need to log in
How to check for the presence of a token?
I'm doing spa on angular 4. The bottom line is that I have an authorization token stored in my localstorage. I have a menu component where I need to show the Login or Logout button in a certain state. As I understand it, I need to check the presence of a token in the storage through the component. Tell me how to implement it, I would like to see the implementation of such a thing. Perhaps someone has an example of such a check.
Answer the question
In order to leave comments, you need to log in
I made a service for the API and it monitors this
https://github.com/DevAlone/learn_these_fucking_wo...
the menu changes depending on the condition here
https://github.com/DevAlone/learn_these_fucking_wo...
It does not pull the storage every times, because it will be slow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question