auth0-blog / redux-auth

MIT License
384 stars 69 forks source link

Too much info on actions.js #8

Open sylvainlap opened 8 years ago

sylvainlap commented 8 years ago

Hello,

What the point to set isAuthenticated & isFetching in your Actions ?

For example:

function requestLogin(creds) {
  return {
    type: LOGIN_REQUEST,
    isFetching: true,
    isAuthenticated: false,
    creds
  }
}

In the action, isFetching & isAuthenticated are set, but not used. This is the role of the reducer. Your action could be simplify to:

function requestLogin(creds) {
  return {
    type: LOGIN_REQUEST,
    creds
  }
}

or am I missing something ?

chenkie commented 8 years ago

They were just left unused for brevity in the article that went along with this :) but they're there to be used if someone wanted to show a spinner or otherwise adjust the UI.

sylvainlap commented 8 years ago

I understand they are in reducers. But why do you put them in actions ?