Permalink
Find file Copy path
cf70ea6 Mar 19, 2018
1 contributor

Users who have contributed to this file

32 lines (23 sloc) 999 Bytes

Type Delimiter Configuration

In the case you need to use different type delimiters, you can configure this globally for all actions. By default, the middleware uses a underscore _ delimiter.

For example, given FOO async action, PENDING type will be appended with a underscore _ delimiter.

{
  type: 'FOO_PENDING'
}

To change the default, supply an optional configuration object to the middleware with the promiseTypeDelimiter property. This property accepts a new string to use as the delimiter.

applyMiddleware(
  promiseMiddleware({
    promiseTypeDelimiter: '/'
  })
)

With this configuration, given FOO async action, the type will be appended with a forward slash / delimiter.

{
  type: 'FOO/PENDING'
}

Finally, if you are using a library like type-to-reducer, you'll also need to [configure it to handle the custom delimiter]](https://github.com/tomatau/type-to-reducer#custom-type-delimiter).