i am trying get multiple url data in single axios. i already added single url but i want to add another url.
i tired this but it giving null object error
{{ BusinessCount }}
{{ UserCount }}
import axios from "axios"; export default { data() { return { businesslists: [], Userslist: [], }; }, async asyncData({ $axios }) { let { datas } = await $axios.$get("/Userslist"); return { Userslist: datas, }; }, computed: { UserCount() { return Object.keys(this.Userslist).length; }, }, async asyncData({ $axios }) { let { data } = await $axios.$get("/Businessregisterlist"); return { businesslists: data, }; }, computed: { BusinessCount() { return Object.keys(this.businesslists).length; }, }, };i want to show like this
<p>{{ BusinessCount }}</p>
<p>{{ UserCount }}</p>
1st url
/Businessregisterlist
2nd url
/Userlist
my code
<template>
<p>{{ BusinessCount }}</p>
</template>
<script>
import axios from "axios";
export default {
data() {
return {
BusinessCounts: [],
};
},
async asyncData({ $axios }) {
let { datad } = await $axios.$get("/Businessregisterlist");
return {
BusinessCounts: datad,
};
},
computed: {
BusinessCount() {
return Object.keys(this.BusinessCounts).length;
},
},
};
</script>