fix: 🐛 move config processing to mirage serializer (#2163)
This commit is contained in:
1 parent
26a77edbc7
commit
5c6c9bb69f
2 files changed
+12
-17
No files matched your search
@@ -632,23 +632,7 @@ function routes() {
|
||||
{ queryParams: { credential_store_id: credentialStoreId } },
|
||||
) => credentialLibraries.where({ credentialStoreId }),
|
||||
);
|
||||
this.get(
|
||||
'/credential-libraries/:id',
|
||||
function ({ credentialLibraries }, { params: { id } }) {
|
||||
const library = credentialLibraries.find(id);
|
||||
// BE API only updates these fields if there's an update mask, otherwise they remain unmodified
|
||||
// but we don't need this flow in our mocks, so we are deleting fields with null value
|
||||
const { credentialMappingOverrides } = library;
|
||||
if (Object.keys(credentialMappingOverrides || {}).length) {
|
||||
Object.keys(credentialMappingOverrides).forEach((key) => {
|
||||
if (credentialMappingOverrides[key] === null) {
|
||||
delete credentialMappingOverrides[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
return library;
|
||||
},
|
||||
);
|
||||
this.get('/credential-libraries/:id');
|
||||
this.post(
|
||||
'/credential-libraries',
|
||||
function ({ credentialStores, credentialLibraries }) {
|
||||
|
||||
@@ -14,6 +14,17 @@ export default ApplicationSerializer.extend({
|
||||
arguments,
|
||||
);
|
||||
json.credential_store_id = model.credentialStoreId;
|
||||
|
||||
// BE API only updates these fields if there's an update mask, otherwise they remain unmodified
|
||||
// but we don't need this flow in our mocks, so we are deleting fields with null value
|
||||
|
||||
if (json.credential_mapping_overrides) {
|
||||
Object.keys(json.credential_mapping_overrides).forEach((key) => {
|
||||
if (json.credential_mapping_overrides[key] === null) {
|
||||
delete json.credential_mapping_overrides[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
return json;
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user