viniciusdacal/redux-arc

how to use the policies in onResponse

Closed this issue · 3 comments

in the documentation have the example of code how to use policies only with beforeRequest, how use with onResponse?

We still need to improve the docs, to include this and other examples.

I wrote an article recently, that approaches that (and all arc's core functionalities):

ARC -  Simplifying async requests in Redux apps
ARC - Simplificando requisições assíncronas em Aplicações Redux[pt-br]

But in summary, you only need to change the applyPoint to onResponse

function myPolicy(store) {
  return done => (action, error, response) => {
    // if you want, you can do something with the response here.
    return done(action, error, response);
  }
}

myPolicy.applyPoint = 'onResponse';

Will let the issue opened till we write the example

closed by #13