Better assign

This commit is contained in:
2018-04-07 14:03:43 +02:00
committed by Michael Bumann
parent b21d2ad864
commit 429f670c12
2 changed files with 12 additions and 12 deletions
+11 -11
View File
@@ -191,7 +191,7 @@ export default Service.extend({
.then(ContributorSerializer.deserialize)
.then((attributes) => {
debug('[kredits] loaded contributor profile', attributes);
return Object.assign(data, attributes);
return Object.assign({}, data, attributes);
})
.catch((err) => {
error(
@@ -293,28 +293,28 @@ export default Service.extend({
return this.get('ipfs')
.storeFile(json)
// Set profileHash
.then((profileHash) => {
// Set new attributes
attributes.profileHash = profileHash;
attributes.balance = 0;
attributes.isCurrentUser = this.get('currentUserAccounts')
.includes(attributes.address);
return attributes;
})
.then((attributes) => {
return this.get('kreditsContract')
.then((contract) => {
let { address, isCore } = attributes;
let { address, isCore, profileHash } = attributes;
let {
digest, hashFunction, size
} = this.getBytes32FromMultihash(profileHash);
debug('[kredits] addContributor', address, digest, hashFunction, size, isCore);
return contract.addContributor(
let contributor = [
address,
digest,
hashFunction,
size,
isCore
);
isCore,
];
debug('[kredits] addContributor', ...contributor);
return contract.addContributor(...contributor);
});
})
.then((data) => {