How to use the vuex-pathify.make.mutations function in vuex-pathify

To help you get started, we’ve selected a few vuex-pathify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Gingernaut / Peridot / src / store / ui.js View on Github external
import { make } from "vuex-pathify"

const state = {
  showNavbar: true,
  showFooter: true,
}

// automatically generate operations
const getters = { ...make.getters(state) }
const mutations = make.mutations(state)
const actions = { ...make.actions(state) }

export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions,
}
github davestewart / vuex-pathify / demo / src / examples / api / vuex / helpers.js View on Github external
}

const getters = {
  // creates redundant getters, for those who like them
  ...make.getters(state),

  // additional total function
  total (state) {
    return state.foo + state.bar + state.baz.value
  }
}

const mutations = {

  // creates SET_* functions
  ...make.mutations(state),

  // additional increment function
  INCREMENT_FOO (state) {
    state.foo++
  }
}

const actions = {

  // creates redundant actions, but for foo only
  ...make.actions('foo'),

  // additional loadFoo action
  loadFoo ({commit}) {
    return new Promise (function (resolve, reject) {
      setTimeout(function () {
github vuetifyjs / vuetify / packages / docs / src / store / modules / documentation.js View on Github external
import {
  getHeadings,
  getNamespace,
} from '../../util/helpers'

const state = {
  deprecatedIn: require('@/data/deprecated.json'),
  links: require('@/data/drawerItems.json'),
  newIn: require('@/data/new.json'),
  namespace: null,
  page: null,
  structure: null,
  toc: [],
}

const mutations = make.mutations(state)
const actions = {}
const getters = {
  breadcrumbs (state, getters, rootState) {
    if (!rootState.route) return []

    const namespace = rootState.route.params.namespace
    const lang = rootState.route.params.lang
    const path = rootState.route.path
    const text = getNamespace(namespace)

    return [
      {
        text: upperFirst(namespace.split('-').join(' ')),
        to: text ? `/${lang}/${text}` : undefined,
        disabled: !text,
      },
github anodyne / nova3 / nova / resources / js / Store / modules / user.js View on Github external
import { make } from 'vuex-pathify';

const moduleState = {};

const mutations = {
    ...make.mutations(moduleState),

    initialUser (state, data) {
        Object.assign(state, data);
    }
};

const actions = {
    setInitialUser ({ commit }, data) {
        commit('initialUser', data);
    }
};

export default {
    namespaced: true,
    state: moduleState,
    mutations,
github pkkid / pushingkarma / src / store.js View on Github external
var makeModule = function(store) {
  return {
    namespaced: true,
    state: store,
    getters: make.getters(store),
    actions: make.actions(store),
    mutations: make.mutations(store),
  };
};
github anodyne / nova3 / nova / resources / js / Store / modules / page.js View on Github external
import { make } from 'vuex-pathify';

const moduleState = {};

export default {
    namespaced: true,
    state: moduleState,
    mutations: {
        ...make.mutations(moduleState)
    }
};
github pkkid / pushingkarma / src / store.js View on Github external
var makeModule = function(store) {
  return {
    namespaced: true,
    state: store,
    getters: make.getters(store),
    actions: make.actions(store),
    mutations: make.mutations(store),
  };
};
github pnowy / github-stars-history / src / store.js View on Github external
import appConfig from "@/config/app.config";

Vue.use(Vuex);

const state = {
  stacks: [],
  showPredefined: true
};

const getters = {};

const findIndexByStackId = stack =>
  state.stacks.findIndex(el => el.id === stack.id);

const mutations = {
  ...make.mutations(state),

  addStack(state, { stack }) {
    state.stacks.push(stack);
  },
  deleteStack(state, { stack }) {
    state.stacks.splice(findIndexByStackId(stack), 1);
  },
  editStack(state, { stack }) {
    state.stacks[findIndexByStackId(stack)] = stack;
  }
};

export default new Vuex.Store({
  plugins: [
    VuexPathify.plugin,
    createPersistedState({ key: appConfig.defaults.persistedStore.name })