Sellsuki / vuex-async-module

vuex-async-module
GNU Affero General Public License v3.0
4 stars 4 forks source link

ย้าย successCallback และ errorCallback ออกไปเป็น Promise #9

Closed n9ti closed 7 years ago

n9ti commented 7 years ago

old

this.getInfoAsync({
  axiosConfig: {
    url: this.url
  },
  dataCallback (data, state) {
    return data.data.msg
  },
  successCallback (data) {
    console.log(data)
  },
  errorCallback (error) {
    console.log(error)
  }
})

new

this.getInfoAsync({
  axiosConfig: {
    url: this.url
  },
  dataCallback (data, state) {
    return data.data.msg
  }
}).then((data) => {
  console.log(data)
}).catch((error) => {
  console.log(error)
})