countSubcategories() function returns [object Promise] where it should return row counts of mapped subcategories.
This code is in vue.js & Laravel, Any suggestions on this?
<div v-for="(cat,index) in cats.data" :key="cat.id"> {{ countSubcategories(cat.id) }} // Here subcategories row counts should be displayed. </div> <script> export default { data() { return { cats: {}, childcounts: "" }; }, created() { this.getCategories(); }, methods: { countSubcategories(id) { return axios .get("/api/user-permission-child-count/" + `${id}`) .then(response => { this.childcounts = response.data; return response.data; }); }, getCategories(page) { if (typeof page === "undefined") { page = 1; } let url = helper.getFilterURL(this.filterpartnerForm); axios .get("/api/get-user-permission-categories?page=" + page + url) .then(response => (this.cats = response.data)); } } }; </script>