The problem of using promise in vuex

Why output undefined instead of 123 here

methods: {
    release () {
      this.$store.dispatch("release").then((res) => {
        console.log(res)
      })
    }
}

vuex

actions: {
    release (val) {
      val.commit("release")
    }
}
mutations: {
    release () {
      return new Promise(function (resolve, reject) {
        resolve(123)
      })
    }
}
Aug.17,2021

to whom is your Promise in mutations ? Your dispatch executes the actions method
and commit does not support the return value

.
Menu