Open Andrei-Pozolotin opened 5 years ago
If you have a solution for this, could you make a pr?
a solution could be a change to a lazy-init
pattern:
Object.defineProperties(Vue.prototype, {
$auth: {
get: function get() {
if (!this.__auth__) {
if (this.$http) { /* use user-provided axios */ } else { /* use default http provider */ }
if (this.$store) { /* use user-provided vuex */ } else { /* ... */ }
if (this.$router) { /* use user-provided vue-router */ } else { /* ... */ }
this.__auth__ = new VueAuthCore(this.$http, this.$store, this.$router, options);
}
return this.__auth__
}
}
});
vue.js
app instances: https://vuex.vuejs.org/guide/state.html when store is injected per-instance:VueAuthPlugin
should behave as store-attached plugin: https://vuex.vuejs.org/guide/plugins.html