Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Added temporary workaround on client for API sending email: {}
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield committed Nov 7, 2019
1 parent 56204d0 commit 798b941
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/serializers/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
return this._super(...arguments);
},

// TODO: do not keep - workaround for API returning `email: {}`
normalize() {
let json = this._super(...arguments);

if (json.data.relationships.email && !json.data.relationships.email.data.id) {
delete json.data.relationships.email;

json.included = json.included.filter((include) => {
return include.type !== 'email';
});
}

return json;
},

serialize(/*snapshot, options*/) {
let json = this._super(...arguments);

Expand Down

0 comments on commit 798b941

Please sign in to comment.