1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Added temporary workaround on client for API sending email: {}

This commit is contained in:
Kevin Ansfield 2019-11-07 16:00:46 +07:00
parent 56204d0129
commit 798b941241

View file

@ -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);