sipp11 9 years ago
parent
commit
d88fa2947a
  1. 13
      src/components/Tx.js

13
src/components/Tx.js

@ -64,7 +64,7 @@ class Tx extends React.Component {
return ( return (
<li key={tx.id}> <li key={tx.id}>
<a onClick={this.changeTx.bind(this, tx)} className="pull-left hollow tiny button">Edit</a> <a onClick={this.changeTx.bind(this, tx)} className="pull-left hollow tiny button">Edit</a>
{tx.date} <b>{tx.amount} {tx.currency}</b> {tx.date} <b>{tx.amount} {tx.currency} <br/><small>{tx.note}</small></b>
</li> </li>
) )
} }
@ -76,17 +76,16 @@ class Tx extends React.Component {
.newTx(tx) .newTx(tx)
.catch(function(err) { .catch(function(err) {
alert("Error creating tx"); alert("Error creating tx");
console.log("Error updating tx ", err); console.log("Error creating tx ", err);
}); });
} }
updateTx(tx) { updateTx(tx) {
tx.user = this.props.user.user_id; tx.user = this.props.user.user_id;
if (!tx.id) { if (!tx.id)
delete tx['id']; return this.newTx(tx)
TxService.newTx(tx);
} return TxService
TxService
.updateTx(tx) .updateTx(tx)
.catch(function(err) { .catch(function(err) {
alert("Error updating"); alert("Error updating");

Loading…
Cancel
Save