Closed VitorLuizC closed 5 years ago
Would be nice to have a helper function similar to mapActions, but for our cache actions.
mapActions
import types from '@/store/types'; import { mapCacheActions } from 'vuex-cache'; export default { ..., methods: mapCacheActions({ fetchUser: 'user/FETCH', fetchServices: { type: 'service/FETCH', timeout: 5000, param: 'ACTIVE' } }), mounted () { this.fetchUser(); this.fetchServices(); } };
mapCacheActions should resolve it's arguments
mapCacheActions({ A: 'ACTION' }) === ({ A () { return this.$store.cache.dispatch('ACTION'); } }) mapCacheActions({ B: { type: 'ACTION', timeout: 200, param: '0' } }) === ({ B () { return this.$store.cache.dispatch({ type: 'ACTION', timeout: 200, param: '0' }); } })
Would be nice to have a helper function similar to
mapActions
, but for our cache actions.mapCacheActions should resolve it's arguments