W
W
WizardW2019-07-04 13:52:43
React
WizardW, 2019-07-04 13:52:43

A good example of implementing authorization and storing user data in the Redux store?

On the Express js backend. With the help of expres-sessions, I authorize the user, set the cookie. At the front (react), you need to store information about the user in the editor so that you visit the site for the first time - initializing the user, setting initialState, the only request to the server to get data about the user. This is if there is a cookie, if there are no cookies, we do not store the information, initialState = {}.
Does anyone have a good example of this implementation?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sinneren, 2019-07-04
@WizardW

https://www.robinwieruch.de/complete-firebase-auth...

A
Anton Spirin, 2019-07-04
@rockon404

There is nothing to implement here:

const store = configureStore();

store.dispatch(init());

const root = (
  <Provider store={store}>
    <App />
  </Provider>
);

In the asynchronous init action, do whatever you want. Until the necessary requests are completed, you can set a flag and show a preloader or a stub instead of content. isInitializtion: true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question