[Vuejs]-Pass computed property as method parameter?

0👍

The first parameter of your action is the store, and the second the payload.
so you should do :

actions:{
    // here: loadStudentsForGrade (store, payload) {
    loadStudentsForGrade ({ commit }, { gradeId }) {
            return new Promise((resolve, reject) => {
                axios.get('/students/'+gradeId)
                    .then((response)=>{
                        //... do stuff
                        //... commit('', response);
                        resolve(response)
                    }, response => {
                        //... commit('', response);
                        reject(response)
                    })
            })
    },
}

Related page in the docs :
https://vuex.vuejs.org/en/actions.html#dispatching-actions

Leave a comment