Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included related resources are ignored in SaveResponses #104

Open
willemdewit opened this issue Oct 11, 2022 · 0 comments
Open

Included related resources are ignored in SaveResponses #104

willemdewit opened this issue Oct 11, 2022 · 0 comments

Comments

@willemdewit
Copy link

When returning included relationships in a response document of a POST, the SaveResponse class ignores the included part of the response document completely.

const savedResource = (await myModel.save()).getModel() as MyModel;
/*
response doc:
{
  "data": {
    "id": 1,
    "type": "myModels",
    "attributes": { ... },
    "relationships": {
      "myRelation": { "data": { "id": "123", "type": "relatedModels" } }
    }
   },
  "included": [{
    "type": "relatedModels",
    "id": "123",
    "attributes": { ... }
  }]
}
*/
console.log(savedResource.getRelation('myRelation')); // undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant