Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
}
}
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 () {
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,
},
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,
var makeModule = function(store) {
return {
namespaced: true,
state: store,
getters: make.getters(store),
actions: make.actions(store),
mutations: make.mutations(store),
};
};
import { make } from 'vuex-pathify';
const moduleState = {};
export default {
namespaced: true,
state: moduleState,
mutations: {
...make.mutations(moduleState)
}
};
var makeModule = function(store) {
return {
namespaced: true,
state: store,
getters: make.getters(store),
actions: make.actions(store),
mutations: make.mutations(store),
};
};
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 })