0👍
try to use async await for your calls.
also be sure that ur id
for retrieveNumbers(id)
is set correct and the api is responding with a payload.
<script>
import userServices from "../services/userServices.js";
export default {
name: "user",
data() {
return {
numbers: [],
currentUser: null,
number: "",
Broj: ""
};
},
methods: {
async getUser(id) {
await userServices.get(id)
.then(response => {
this.currentUser = response.data;
console.log(response.data);
})
.catch(e => {
console.log(e);
});
},
async retrieveNumbers(id) {
await userServices.getNumber(id).then(response => {
this.numbers = response.data;
console.log(response.data);
})
.catch(e => {
console.log(e);
});
}
},
async created() {
await this.getUser(this.$route.params.id);
await this.retrieveNumbers(this.$route.params.id);
}
};
</script>
Source:stackexchange.com