title: Redux middleware getting access to store
body: <p>Using Redux I am implementing an external package which exposes the following middleware, as the second parameter it expects a <code>function</code> which returns a <code>Promise</code></p>
  
  <pre><code>const token = () =&gt; {
    // I want to get some data which is already in the store here.
    return fetch('endpoint')
    .then((response) =&gt; response.text())
  }
  
  const createStoreWithMiddleware = applyMiddleware(
    middleware({Some: 'Object'}, token)
  )(createStore)
  </code></pre>
  
  <p>My issue is I need to grab data which is already in the <code>state</code>, in this case an auth token. Does anyone have a good idea how I can grab the <code>state</code>? I know inside a middleware function I have access to the <code>store</code> but I don't control this external package so I am stuck with this method signature.</p>