import Vue from 'vue'; import { mapGetters, mapMutations, mapState } from 'vuex'; Vue.mixin({ computed: { ...mapGetters([ "isLoading", "isLoggedIn", "isAdmin" ]), ...mapState([ "user" ]) }, methods: { ...mapMutations([ 'setError', 'setLoading' ]), loadResource(promise) { this.setLoading(true); return promise .catch(err => this.setError(err)) .then(() => this.setLoading(false)); } } });