Ghost/ghost/admin/app/serializers/subscriber.js
Kevin Ansfield 5a4976f669 🐛 Fixed error when creating subscribers via the admin area
refs https://github.com/TryGhost/Ghost/issues/10569
- updates the Subscriber serialiser to strip the `status` property from the API request when saving if it's falsy
2019-03-06 09:19:39 +00:00

21 lines
500 B
JavaScript

import ApplicationSerializer from 'ghost-admin/serializers/application';
export default ApplicationSerializer.extend({
attrs: {
unsubscribedAtUTC: {key: 'unsubscribed_at'},
createdAtUTC: {key: 'created_at'},
updatedAtUTC: {key: 'updated_at'}
},
serialize() {
let json = this._super(...arguments);
// the API can't handle `status` being `null`
if (!json.status) {
delete json.status;
}
return json;
}
});