Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* See comments for details
*/
import { make } from 'vuex-pathify'
const state = {
foo: 1,
bar: 2,
baz: {
value: 3
},
}
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++
}
id: null,
firstName: null,
lastName: null,
emailAddress: null,
token: null,
phoneNumber: null,
userRole: null,
UUID: null,
isVerified: null,
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,
}
var makeModule = function(store) {
return {
namespaced: true,
state: store,
getters: make.getters(store),
actions: make.actions(store),
mutations: make.mutations(store),
};
};
export function makeGetters(defaultState, ...getters) {
const data = { ...make.getters(defaultState) };
for (let d of getters) {
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),
};
};