javascript - Intermittent Axios Get Request Failure -
i have laravel , vue js application, i'm having intermittent issues request vue js & axios, can hit route directly in browser , works fine data returned. load view calls data via axios vue js , works , doesn't.. find if open debugger on right of chrome call fires , works fine. close , fails.
error being returned:
failed load resource: server responded status of 500 (internal server error) uncaught (in promise) error: request failed status code 500
my laravel route follows:
route::get('/orders/today','orderscontroller@today');
my vuejs file has following:
axios.defaults.headers.common['x-csrf-token'] = document.queryselector('#_token').getattribute('value'); var vue = new vue({ el: '#app', data: { orders: [], estimates: [] }, mounted : function() { this.getorders(); }, methods: { getorders: function() { axios.get('/orders/today').then(response => [this.orders = response.data.data, this.estimates = response.data.data2]); console.log(this.orders); } } })
Comments
Post a Comment