mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
00ab9cdb1b
no issue We've seen an issue where after an import a user record had `tour: ""` which meant they were unable to log in due to JSON parsing of the empty string failing. - add a guard so that an empty string is transformed to `null` before parsing - changed `serialised` to `serialized` to match spelling in all other serializers
11 lines
330 B
JavaScript
11 lines
330 B
JavaScript
import Transform from 'ember-data/transform';
|
|
|
|
export default Transform.extend({
|
|
deserialize(serialized) {
|
|
let _serialized = serialized === '' ? null : serialized;
|
|
return JSON.parse(_serialized);
|
|
},
|
|
serialize(deserialized) {
|
|
return deserialized ? JSON.stringify(deserialized) : null;
|
|
}
|
|
});
|