2018-09-25 16:28:26 +00:00
|
|
|
import ApplicationSerializer from './application';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default ApplicationSerializer.extend({
|
2018-04-03 14:16:57 +00:00
|
|
|
extractLazyPaginatedData(payload) {
|
|
|
|
let ret;
|
|
|
|
if (payload.zero_address_roles) {
|
|
|
|
payload.zero_address_roles.forEach(role => {
|
|
|
|
// mutate key_info object to add zero_address info
|
|
|
|
payload.data.key_info[role].zero_address = true;
|
|
|
|
});
|
|
|
|
}
|
2018-09-25 16:28:26 +00:00
|
|
|
if (!payload.data.key_info) return payload.data.keys;
|
2018-04-03 14:16:57 +00:00
|
|
|
ret = payload.data.keys.map(key => {
|
|
|
|
let model = {
|
|
|
|
id: key,
|
|
|
|
key_type: payload.data.key_info[key].key_type,
|
|
|
|
zero_address: payload.data.key_info[key].zero_address,
|
|
|
|
};
|
|
|
|
if (payload.backend) {
|
|
|
|
model.backend = payload.backend;
|
|
|
|
}
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
delete payload.data.key_info;
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
});
|