Flow Control
Learn how to use middleware for flow control.
We'll cover the following...
One important usage of middleware is to control the application’s flow and logic. Let’s consider a sample user login flow:
- Send POSTrequest to the server to log in
- Save access token in store
- Fetch current user’s profile information
- Fetch the latest notifications
Usually, our flow will begin with a LOGIN action containing the login credentials:
{
  type: 'LOGIN',
  payload: {
    email: 'info@redux-book.com',
    password: 'will-never-tell'
  }
}
 Ask