title: Vue JS/ superagent - TypeError: fn is not a function
body: <p>I'm using super agent for HTTP request and I'm trying to use superagent-intercept to catch HTTP requests in order to manage errors and necessary redirections.</p>
  
  <p>When a componant is mounted I call an action from Vuex :</p>
  
  <pre><code>GLOBAL_DATA({commit, state}) {
      forms_store.get(null,  (result) =&gt; {
          commit('SET_FORMS', result)
      });
  }
  </code></pre>
  
  <p>Which call : </p>
  
  <pre><code>forms.get = function(root, cb) {
    request
    .get(`${api}/forms/name/FORM`)
    .use(interceptor.auth)
    .use(nocache)
    .withCredentials()
    .set('Accept', 'application/json')
    .end(function(err, res) {
   if (res.body.status === 'success') {
         cb(res.body.data.forms, root)
      } else if (common.token(res)) {
        common.cb(root);
      } else {
        console.log("error");
      }
    });
  };
  </code></pre>
  
  <p>Considering : </p>
  
  <pre><code>interceptor.auth = require('superagent-intercept')((error, results) =&gt; {
          // Error handling .. 
  });
  </code></pre>
  
  <p>But I have an error in GLOBAL_DATA : </p>
  
  <blockquote>
    <p>TypeError: fn is not a function</p>
  </blockquote>
  
  <p>I think something is overridden at some point but I can't figure out how to fix it.</p>
  
  <p>Edit : </p>
  
  <p>I changed the syntax of the first function but I still have the same error : </p>
  
  <pre><code>GLOBAL_DATA : (context) =&gt; {
      forms_store.get(null,  (result) =&gt; {
          context.commit('SET_FORMS', result)
  });
  </code></pre>