fix: 🐛 clear token on normalization (#1351)

* fix: 🐛 clear token on normalization
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-09-26 18:25:02 -07:00
1 parent 0cba914045
commit 3fc22b4aa3
3 files changed
+86 -42

No files matched your search

@@ -1,4 +1,5 @@
import ApplicationSerializer from './application';
import { copy } from 'ember-copy';
export default class CredentialStoreSerializer extends ApplicationSerializer {
/**
@@ -38,4 +39,12 @@ export default class CredentialStoreSerializer extends ApplicationSerializer {
delete serialized.attributes;
return serialized;
}
normalize(typeClass, hash, ...rest) {
const normalizedHash = copy(hash, true);
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
// Remove secret fields as we don't track them after being created/updated
normalized.data.attributes.token = '';
return normalized;
}
}