[Vuejs]-TypeError :Cannot read property 'id' of undefined in Vue

0👍

So, you properly defined user in component data. And the error you are getting might happen only in the case if res.data.user is undefined which you are getting from API in getUsers method.
I suggest, there is no user object in response data. By that way res.data.user is undefined and as you reasigned this.user to be equal res.data.user it get undefined value too.

0👍

Instead of “this.user = res.data.user” we have to wight “this.user = res.data”. And this solved this problem.

Leave a comment