Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 () {
const value = Date.now()
commit('SET_FOO', value)
resolve(value)
}, 1000)
})
}
}
export default {
namespaced: true,
state,
createdTime: null,
modifiedTime: null,
}
}
// automatically generate operations
const getters = { ...make.getters(state) }
const mutations = {
...make.mutations(state),
// setting the store back to it's initial state (logout, etc.)
reset(s) {
Object.assign(s, state())
},
}
const actions = { ...make.actions(state) }
export default {
namespaced: true,
state,
getters,
mutations,
actions,
}
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,
}
export function makeActions(defaultState, ...actions) {
const data = { ...make.actions(defaultState) };
for (let d of actions) {
Object.assign(data, d);
}
return data;
}
var makeModule = function(store) {
return {
namespaced: true,
state: store,
getters: make.getters(store),
actions: make.actions(store),
mutations: make.mutations(store),
};
};
var makeModule = function(store) {
return {
namespaced: true,
state: store,
getters: make.getters(store),
actions: make.actions(store),
mutations: make.mutations(store),
};
};