Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

NuxtJs Cannot read property '_normalized' of undefined

$
0
0

this error show when I try to fetch some data in nuxtjs

Cannot read property '_normalized' of undefined

This is my axios request in nuxtjs :

 async asyncData({app}){
        var response = await app.$axios.get('/store/get-services',{params:{id:app.$auth.user.store.id}});
        return {services:response.data.services};
    }

this is a backend controller laravel:

public function store_ads(Request $req){
    if($req->user()->store->id != $req->id){
        abort(403);
    }
    $services = Store::select('id')->with('ads:id,store_id,price,title')->where('id',$req->id)->first();
    return response()->json(['services'=>$services],200);
}

and here is how i fetch them in my template:

<div class="services-list">
                        <h4 class="is-vcentered title has-text-centered has-text-grey-light" v-if="services.ads.length==0">No Services</h4>
                        <ul>
                            <li v-for="service in services.ads" :key="service.id"><nuxt-link>{{service.title}}</nuxt-link></li>
                        </ul>
                    </div>

What is the reason?


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>