GithubHelp home page GithubHelp logo

vuex-actions's People

Contributors

repairearth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vuex-actions's Issues

payload is missing in promise

defined an action use createAction. invoke it in mounted as this.getData().then(resilt => { })
result is undefined.
In source code, function commitAsSuccess and function dispatchAction return undefined

Use within modules

Hi,

I have been trying to use vuex-actions within my store, but not on the main store, rather in its modules. I can't figure out, but the dispatch handler is called with the following type key: "[0]setPath".

Console error:
Error message: [vuex] unknown action type: [0]setPath

Stacktrace:

[vuex] unknown action type: [0]setPath
(anonymous function) -- build.umd.min.js:1:12484
dispatch -- vuex.js:242
o -- vex-action.min.js:1:1477
wrappedActionHandler -- vuex.js:451
(anonymous function) -- main.js:103 // my trigger for dispatch

Do you know if vuex-actions should work with modules? And if so, what am I missing?

Here's my store module implementation:

// import * as types from '../types'
// changing to vuex-action
import { createAction } from 'vuex-action'

const state = {
  currentPath: ''
}

// const actions = {
//   setPath ({ commit, state }, path) {
//     if (state.currentPath !== path) {
//       commit(types.CHANGE_URL_PATH, path)
//     }
//   }
// }

const setPath = createAction('setPath')

const actions = {
  setPath: setPath
}

const getters = {
  getCurrentPathTransition: state => {
    let trans = ''

    switch (state.currentPath) {
      case '':
      case '/':
        trans = 'slide-right'
        break
      case 'area':
        trans = 'slide-left'
        break
      default:
        break
    }

    return trans
  }
}

const mutations = {
  // [types.CHANGE_URL_PATH] (state, path) {
  //   state.currentPath = path
  // },
  [setPath] (state, path) {
    state.currentPath = path
  }
}

export default {
  state,
  mutations,
  getters,
  actions
}

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.