title: Vue.js / Mixins - Is there a way to get the global mixin-object outside of the vue component?
body: <p>I am new with Vue.js</p>
  
  <p>I am using Vue.js 2.4.4.
  I have created the global mixin in my app.js file:</p>
  
  <pre><code>...
  import router from './router'
  ...(some imports and plugins definitions)
  
  Vue.use(VeeValidate);
  Vue.component(VuePassword);
  ...
  
  Vue.mixin({
      data: function(){
          return {
              get auth(){
                  return Auth;
              }
          }
      }
      });
  
  const app = new Vue({
      el: '#root',
      template: `&lt;app&gt;&lt;/app&gt;`,
      components: { App },
      router
  });
  </code></pre>
  
  <p>This mixin imports some Auth object with validation methods e.t.c which needed to be in every component. 
  All of my components can check this mixin and it's working fine.</p>
  
  <p>But I need to check the auth state after every route request, and I want to use my currently existing mixin, so I am trying to make something like this in my router.js file:</p>
  
  <pre><code>import Vue from 'vue'
  import VueRouter from 'vue-router'
  ...
  
  Vue.use(VueRouter);
  
  const router = new VueRouter({
      routes:[
        ...
      ]
  });
  router.beforeEach((to, from, next) =&gt; {
      if(to.meta.requiresAuth) {
          if(...call to mixin method) {
              next();
          } else {
              next('/');
          }
      } else {
          next();
      }
  });
  
  export default router
  </code></pre>
  
  <p><strong>Question:</strong>
  Is there a way to get the global mixin object and change it's inner values or can you please give some small advise or example what is the right solution to this kind of tasks?
  Or should I use the plugins instead of mixins?</p>