Answer the question
In order to leave comments, you need to log in
How to send requests to Vuex to backend via graphql?
Hello, such a question:
- How can, for example, implement a user login in the vuex store through an action?
It’s just that I implemented a user login on the backend and when logging in, it returns the session
. I tried to log in using Axios, but the session didn’t come up like that
Answer the question
In order to leave comments, you need to log in
It is necessary to give a token, not a session, no one uses sessions if the back and front are separate, because they only work for a specific domain and port, which is inconvenient in development. The easiest way is to generate a hash after login, give it to the front, the front saves this token in the local storage and passes it in the header with each request. The server checks the header and determines by the token in it whether it is logged in or not, what kind of user it is, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question