title: Vuex store is undefined in NUXT middleware
body: <p>I'm practicing NUXT and from tutorial its working well. mine fail when entering the NUXT middleware. the logic is if page is redirecting to other page it will enter middleware and fetch the result using axios. </p>
  
  <p><strong>middleware/search.js</strong></p>
  
  <pre><code>import axios from 'axios';
  
  export default function ({ params, store }) {
      console.log(store)
  
      return axios.get(`https://itunes.apple.com/search?term=~${params.id}&amp;entity=album`)
          .then((response) =&gt; {
              console.log(response.data.results);
              store.commit('add', response.data.results)
          })
  }
  </code></pre>
  
  <p>when entering here the <code>store.commit('add'...</code> will result  </p>
  
  <blockquote>
    <p>Cannot read property 'commit' of undefined</p>
  </blockquote>
  
  <p>when I echo commit = undefined.</p>
  
  <p>What I'm missing? I already tried <code>this.$store.commit(...)</code> still undefined.</p>
  
  <h1>VUEX</h1>
  
  <p><strong>store/index.js</strong></p>
  
  <pre><code>import Vuex from 'vuex'
  
  const createStore = () =&gt; {
    return new Vuex.Store({
      state: {
        albums: []
      },
      mutations: {
        add (state, payload) {
          state.albums = payload
        }
      }
    })
  }
  
  export default createStore
  </code></pre>