refactor: Refactor seralizeScopeID from models to serializers
This commit is contained in:
11 files changed
+63
-30
No files matched your search
@@ -7,6 +7,14 @@ import { copy } from 'ember-copy';
|
||||
* Manages serialization/normalization of data to/from the API.
|
||||
*/
|
||||
export default class ApplicationSerializer extends RESTSerializer {
|
||||
|
||||
// =properties
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
serializeScopeID = true;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -71,7 +79,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
// Delete `scope` field
|
||||
delete serialized.scope;
|
||||
// And serialize `scope_id`
|
||||
if(snapshot?.record?.serializeScopeID) {
|
||||
if(this.serializeScopeID) {
|
||||
const scope_id = snapshot?.attr('scope')?.attr('scope_id');
|
||||
if (scope_id) serialized.scope_id = scope_id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user