I'm having trouble accessing the data within the user
object.
{
"channel_id": 2,
"user": {
"id": 1,
"name": "Clyde Santiago",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="187c7d606c7d6a7c7d6e282a587f75797174367b7775">[email protected]</a>",
"created_at": "2017-07-25 08:10:58",
"updated_at": "2017-07-25 08:10:58"
},
"message": "ssd"
}
It's working fine when I access the channel_id
, user
, and message
. However, I encounter an error when trying to access the data within the user
object,
"Cannot read property 'name' of undefined"
Below is the HTML code snippet from my Vue component
<ul class="list-group">
<li class="list-group-item" v-for="conversation in conversations">
<p>
{{conversation.message}}
</p>
<small>{{conversation.user.name}}</small> // error here
</li>
</ul>