bug fixed in formatCard function

This commit is contained in:
Dani Herrero 2017-10-04 09:07:14 +02:00
parent 8e5eca5629
commit 9fbc404aa1
1 changed files with 5 additions and 4 deletions

View File

@ -36,10 +36,11 @@ module.exports = function(Client) {
function formatCard(card) {
let cardFormated = JSON.parse(JSON.stringify(card));
cardFormated.salesPerson = {
id: card.salesPerson().id,
name: `${card.salesPerson().name} ${card.salesPerson().surname}`
};
if(cardFormated.salesPersonFk)
cardFormated.salesPerson = {
id: card.salesPerson().id,
name: `${card.salesPerson().name} ${card.salesPerson().surname}`
};
return cardFormated;
}
};