Files
kredits-web/app/utils/process-reimbursement-data.js
T
basti 95743330e4 WIP Generic data handling and caching
Add basic support for reimbursements via new, generic data handling
functions.
2020-06-27 16:35:45 +02:00

21 lines
561 B
JavaScript

export default function processReimbursementData(data) {
const processed = {}
if (data.confirmedAtBlock && (typeof data.confirmedAtBlock.toNumber === 'function')) {
processed.confirmedAt = data.confirmedAtBlock.toNumber();
} else if (data.confirmedAt !== 'undefined') {
processed.confirmedAt = data.confirmedAt;
}
const otherProperties = [
'id', 'contributorId', 'token', 'amount', 'vetoed', 'ipfsHash',
'expenses', 'pendingTx'
];
otherProperties.forEach(prop => {
processed[prop] = data[prop];
});
return processed;
}