kaidjohnson/redux-first-vue-routing

View on GitHub
src/plugin.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { locationChange } from './action-creators.js';

/**
 * @param {Object} Vue
 * @param {Object} options
 * @param {Object} options.router
 * @param {Object} options.store
 */
const install = (Vue, { router, store }) => {
    router.beforeResolve((to, from, next) => {
        store.dispatch(locationChange(to));
        next();
    });
};

export default { install };