Skip to content

Commit

Permalink
Update Employee.js
Browse files Browse the repository at this point in the history
  • Loading branch information
carolluo0916 authored Jan 27, 2018
1 parent 4c7719a commit 7ccdab8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Lesson5/orgin/src/components/Employee.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ class Employer extends Component {
}

checkEmployee = () => {
const{payroll,employee,web3} = this.props;
payroll.employees.call(employee,{
from:employee,
gas:1000000
const{payroll,account,web3} = this.props;
payroll.employees.call(account,{
from:account,
}).then((result)=>{
console.log(result)
this.setState({
salary:web3.fromWei(result[1].toNumber()),
lastPaidDate: new Date(result[2].toNumber()*1000)
lastPaidDate: new Date(result[2].toNumber()*1000).toString()
});
});

web3.eth.getBalance(account,(err,result) =>{
this.setState({
balance:web3.fromWei(result.toNumber())
});
});
}

getPaid = () => {
Expand Down

0 comments on commit 7ccdab8

Please sign in to comment.