A
A
Adel Khalitov2019-05-12 20:57:30
Angular
Adel Khalitov, 2019-05-12 20:57:30

How to make a request on the first visit to the client?

Here is an example, let's say there are secure pages that only an authorized user can access. I don't need to make a request to the server every time I go to secure pages, I need to make a request if the client has entered the secure channel for the first time.
There is an idea to implement the canActivate service, check cookies, if they are not there, make a request to the server to check authorization, receive a response from the server and write data about the first visit to the server in cookies.
If the session ends, then the cookies disappear accordingly.
Are there any easier options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maks Kovyvchak, 2019-06-24
@max_front

If I were you, I would use the browser's sessionStorage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question