Search code examples
reactjsfluxreactjs-flux

Login ajax request Flux React?


How can I do
after login form submit (React Component)
using flux structure
ajax request that provides response ?
Can you provide some example ?


Solution

  • Basically you need to make an Ajax request, and then create success/error handlers. Inside those handlers, you will create actions to inform your stores of the result. It's probably a good idea to have an AppStore or SessionStore or something that will hold the data related to the current user and the auth token. Your controller-views can listen to that store and render their children when the current user becomes authenticated.