cantierecreativo/redux-bees

'before' middleware

Opened this issue · 0 comments

jariz commented

Besides 'after' middleware(s), a 'before' middleware would probably also be a good idea.
I recently ran into an issue where I had to refresh a token if it was past a certain date.
I ended up wrapping all my api calls & query decorators with a check that would do the refresh, but it'd of course be much better if this could be configured globally from bees itself.

I think it'd look something like this:

  before(...args) {
    return new Promise(resolve => setTimeout(() => resolve(...args);
  },