I am trying to code feature that allows logged-in users to add products to a "saved item" list. The model is:
//saveditem.js model
export default DS.Model.extend({
user: belongsTo('user'),
product: belongsTo('product', { async: true }),
dateAdded: attr('string')
});
On the saveditems
route where the saved items are displayed, the model()
hook is:
model() {
return this.get("store").findAll('saveditem');
}
the api is returning records with JUST the ids:
{
"dateAdded": "Mon, 11 Dec 2017 20:59:10 GMT",
"id": 4458,
"product": 4458,
"user": "me"
},
{
"dateAdded": "Sun, 10 Dec 2017 10:26:02 GMT",
"id": 3657,
"product": 3657,
"user": "me"
}
...
How can I get the hasMany relationship to load the actual products, using the IDs?
Aucun commentaire:
Enregistrer un commentaire