chore: 🤖 alias target route (#2228)

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2024-04-12 16:36:17 -07:00
1 parent c550faddb4
commit bd65c91ff9
21 files changed
+745 -17

No files matched your search

+13
View File
@@ -120,4 +120,17 @@ export default class TargetSerializer extends ApplicationSerializer {
storage_bucket_id: snapshot?.attr('storage_bucket_id'),
};
}
normalize(typeClass, hash, ...rest) {
const normalizedHash = structuredClone(hash);
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
// Ember data retains the previous entry in the array attr when the updated attr becomes undefined/empty.
// So, we explicitly set the attr to an empty array if the updated attribute is undefined from the API
if (!normalized.data.attributes.aliases) {
normalized.data.attributes.aliases = [];
}
return normalized;
}
}