[Vuejs]-Axios call works inside Vue.js mounted() but not inside function

0👍

try this

async loadCenters: function (soc) {
    const params = { society: soc }
    try {
      const { data } = await axios.get('/ajax/load-centers', { params })
      console.log( 'Request Executed' )
      console.log( data )
    } catch ( e ) {
      console.log(e)
    }
}

Leave a comment