S
S
Sergey Alekseev2018-03-06 10:27:20
React
Sergey Alekseev, 2018-03-06 10:27:20

Django rest framework, react, redux how to make user login?

Good afternoon, logically I do not understand how to implement this. There is, for example, a user model, a serializer for email and password fields. There is also a view which is an api method and distributes a response status of 200 or 400. This is the backend.
There is a frontend. The view component is the login form. It has a handler that launches an action and passes the data entered by the user from the form. I do not understand where to write a request for api. In action? And where to store the session associated with a specific user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-03-06
@serj2000

The request to the api is, of course, in the action (well, to be more precise, in AC - action creator, a function that dispatches your actions). Store the session where it is more convenient for you. If it was a JWT, it could be stored in localStorage, although there is a lot of controversy about this (is it safe or not to store in LS).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question