[Vuejs]-Async function result

0👍

First of all, this needs to be an async method, async computed are not handled by vue vanilla, you’d need a plugin for those.

The first return defines the value of apiResponse then, the 2nd return
of apiResponse defines the return value of the method itself

methods: {
  async getAsset() {
    const apiResponse = await apis.getAssetById(this.$route.params.id, this.tb.JWT)
    .then(res => {
      return res;
    });
    return apiResponse  
  },
},

Leave a comment