I have model which has a hasMany async relationship,
export default Model.extend({
name: attr(),
description: attr(),
metricNamespaces: hasMany('metric-namespace', {
async: true
})
});
Here is a sample jSONAPI doc of a model instance
{
"data": {
"type": "context",
"id": "1",
"attributes": {
"name": "O'Reilly Inc",
"description": "Aut mollitia mollitia esse inventore est consequatur mollitia ex dolores. Deserunt est dicta temporibus eius. Id dicta molestiae nostrum odio."
},
"relationships": {
"metricNamespaces": {
"data": [
{
"type": "metric-namespace",
"id": "8"
}
]
}
}
}
}
I have an afterModel hook in a route which tries to fetch the relationships
model.get('metricNamespaces').then((success) => {
console.log("Success", success);
}, (error) => {
console.log("Error", error);
});
I expect this to trigger a get request to Mirage. But this never triggers a get request (Which should fail since I don't have a mirage route for the metric-namespace
get)
Can someone help me figure out what I am missing?
Aucun commentaire:
Enregistrer un commentaire