I am trying to display data in a table using axios. At the heart of table # 8 Paginate and sort server-side from here https://vuetifyjs.com/components/data-tables . Changed only getUsers method, it looks like this

getUsers () { var self = this; return axios.get('http://localhost/api/items') .then(function(res) { self.items = res.data; }) .catch(function(err) { return Promise.reject(err.status); }); } 

It works, but not quite - I get in the console

Uncaught (in promise) TypeError: items.sort is not a function

Actually the question is, how to make ajax request correctly?

  • Do I understand correctly that I need an array and return an object? - Guest
  • When receiving data, do console.dir (res.data) and see what comes to you - Alexey Matveev

0