[Vuejs]-Why is this happening? I'm getting correct display in console output and right amount of rows in UI but I'm getting no outputs

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>

Leave a comment