[Vuejs]-Call method on data state

0👍

You need to return ‘brandNames’ after map info.

Notice: Also you can call this method in created() hooks before component mounted(). This useful to get response before initialize template.

Good luck

0👍

I found the solution. The error was that the api call needed the promise response. For this I created an "async" method that waits for the data to be returned before passing it to the list

export default {
  data: function () {
    return {
      filter: null,
      brandNames: null,
    };
  },
  created() {
   this.fetchBrandNames()
 },
 methods: {
   async fetchBrandNames() {
     const response = await Nova.request().get('/nova-vendor/export/brands-list');
     this.brandNames = response.data;
   }
 }
}

Leave a comment