How to use vuex-easy-access - 10 common examples

To help you get started, we’ve selected a few vuex-easy-access 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 mesqueeb / vuex-easy-firestore / test / helpers / store / testNestedFillables.ts View on Github external
}
  }
}

export default {
  // easy firestore config
  firestorePath: 'configTests/nestedFillables',
  firestoreRefType: 'doc',
  moduleName: 'nestedFillables',
  statePropName: null,
  sync: {
    fillables: ['nested.fillables.yes'],
  },
  // module
  state: initialState(),
  mutations: defaultMutations(initialState()),
  actions: {},
  getters: {},
}
github mesqueeb / vuex-easy-firestore / test / helpers / store / pokemonBox.ts View on Github external
insertHook: function (updateStore, doc, store) {
      doc.addedBeforeInsert = true
      return updateStore(doc)
    },
    patchHook: function (updateStore, doc, store) {
      doc.addedBeforePatch = true
      return updateStore(doc)
    },
    deleteHook: function (updateStore, id, store) {
      if (id === 'stopBeforeDelete') return
      return updateStore(id)
    }
  },
  // module
  state: initialState(),
  mutations: defaultMutations(initialState()),
  actions: {},
  getters: {},
}
github mesqueeb / vuex-easy-firestore / test / helpers / store / testPathVar.ts View on Github external
return {
    name: 'Satoshi',
    pokemonBelt: [],
    items: []
  }
}

export default {
  // easy firestore config
  firestorePath: 'coll/{name}',
  firestoreRefType: 'doc',
  moduleName: 'testPathVar',
  statePropName: null,
  // module
  state: initialState(),
  mutations: defaultMutations(initialState()),
  actions: {},
  getters: {},
}
github mesqueeb / vuex-easy-firestore / test / helpers / store / initialDoc.ts View on Github external
function initialState () {
  return {
    iniProp: true,
  }
}

export default {
  // easy firestore config
  firestorePath: 'docs/{randomId}', // this should be randomized each test
  firestoreRefType: 'doc',
  moduleName: 'initialDoc',
  statePropName: null,
  // module
  state: initialState(),
  mutations: defaultMutations(initialState()),
  actions: {},
  getters: {},
}
github mesqueeb / vuex-easy-firestore / test / helpers / store / serverHooks.ts View on Github external
function initialState () {
  return {
    iniProp: true,
    defaultPropsNotToBeDeleted: true
  }
}

export default {
  // easy firestore config
  firestorePath: 'configTests/serverHooks', // this should be randomized each test
  firestoreRefType: 'doc',
  moduleName: 'serverHooks',
  statePropName: null,
  // module
  state: initialState(),
  mutations: defaultMutations(initialState()),
  actions: {},
  getters: {},
  sync: {
    guard: ['created_by', 'created_at', 'updated_by', 'updated_at']
  }
}
github mesqueeb / vuex-easy-firestore / test / helpers / index.cjs.js View on Github external
name: 'Satoshi',
        pokemonBelt: [],
        items: [],
        multipleFastEdits: null,
        stepCounter: 0,
    };
}
var mainCharacter = {
    // easy firestore config
    firestorePath: 'playerCharacters/Satoshi',
    firestoreRefType: 'doc',
    moduleName: 'mainCharacter',
    statePropName: null,
    // module
    state: initialState$1(),
    mutations: createEasyAccess.defaultMutations(initialState$1()),
    actions: {},
    getters: {},
};

function initialState$2() {
    return {
        playerName: 'Satoshi',
        pokemon: {},
        stats: {
            pokemonCount: 0,
            freedCount: 0,
        }
    };
}
var pokemonBoxVEA = {
    // easy firestore config
github Dappos / Dappos / src / store / modules / history.js View on Github external
updateStore(doc)
    },
  },
  serverChange: {
    defaultValues: defaultReceit()
  },
  // module:
  namespaced: true,
  state: initialState(),
  mutations:
  {
    resetStateData (state) {
      const newState = initialState()
      Object.assign(state, newState)
    },
    ...defaultMutations(initialState(), easyAccessConf)
  },
  actions:
  {
  },
  getters:
  {
    receitByTxnHash: (state, getters) => {
      return Object.values(state.receits)
        .reduce((carry, receit) => {
          if (!receit.txn) return carry
          const txnHash = receit.txn.hash
          carry[txnHash] = receit
          return carry
        }, {})
    },
  }
github Dappos / Dappos / src / store / modules / keypad.js View on Github external
function initialState () {
  return {
    input: 0,
  }
}

export default {
  namespaced: true,
  state: initialState(),
  mutations:
  {
    resetStateData (state) {
      const newState = initialState()
      Object.assign(state, newState)
    },
    ...defaultMutations(initialState(), easyAccessConf)
  },
  actions:
  {
    tap ({state, getters, rootState, rootGetters, commit, dispatch}, input) {
      // console.log('state.input → ', state.input)
      const precisionCorrection = 10 ** rootGetters['settings/currencyConfig'].precision
      // console.log('precisionCorrection → ', precisionCorrection)
      const oldVal = Math.floor(state.input * precisionCorrection)
      if (oldVal.toString().length >= 9) return
      // console.log('oldVal → ', oldVal)
      const newVal = Number(oldVal.toString() + input.toString()) / precisionCorrection
      dispatch('set/input', newVal)
      // console.log('state.input → ', state.input)
    },
    clear ({state, getters, rootState, rootGetters, commit, dispatch}) {
      dispatch('set/input', 0)
github Dappos / Dappos / src / store / modules / menulist.js View on Github external
serverChange: {
    defaultValues: {prices: defaultPrices()},
    // modifiedHook: function (updateStore, doc, id, store) {
    //   console.log('doc → ', doc)
    //   updateStore(doc)
    // },
    // removedHook: function (updateStore, doc, id, store) {
    //   console.log('doc → ', doc, ' id ', id)
    //   updateStore(doc)
    // },
  },
  // module:
  state: initialState(),
  mutations:
  {
    ...defaultMutations(initialState(), easyAccessConf),
    resetStateData (state) {
      const newState = initialState()
      Object.assign(state, newState)
    },
    replaceMenulist (state, payload) {
      state.items = payload
    },
    updateState (state, payload) {
      Object.keys(payload).forEach(key => {
        this._vm.$set(state, key, payload[key])
      })
    },
    clearTestItems (state) {
      state.items = {}
    },
  },
github Dappos / Dappos / src / store / modules / _template.js View on Github external
}
}

export default {
  namespaced: true,
  state: initialState(),
  mounted () {
    console.log('this → ', this)
  },
  mutations:
  {
    resetStateData (state) {
      const newState = initialState()
      Object.assign(state, newState)
    },
    ...defaultMutations(initialState(), easyAccessConf)
  },
  actions:
  {
    'setColors.primary': ({state, commit, dispatch}, newColor) => {
      // dispatch('patchToServer', state.colors.primary, {root: true})
      // console.log('patched')
      return dispatch('set/colors.primary', newColor)
    },
    doIt (
      {state, getters, rootState, rootGetters, commit, dispatch},
      {id} = {}
    ) {
      // getters.someOtherGetter // -> 'foo/someOtherGetter'
      // rootGetters.someOtherGetter // -> 'someOtherGetter'

      dispatch('someOtherAction') // -> 'foo/someOtherAction'

vuex-easy-access

Unified syntax with simple set() and get() store access + auto generate mutations

MIT
Latest version published 5 years ago

Package Health Score

45 / 100
Full package analysis

Popular vuex-easy-access functions