FIxing showing ENS section conditions

This commit is contained in:
Richard Ramos 2018-10-04 22:31:39 -04:00
parent 139c8f1527
commit 594e4f3e96
2 changed files with 6 additions and 8 deletions

View File

@ -24,7 +24,7 @@ To generate the codes, execute `node server/codegen.js`. This comand will output
A nodejs service was created to receive funding requests. It requires a geth light node to run
0. `chmod 600 server/config.js`
1. Edit `server/config.js` and set the contract address and the private key of the controller address.
2. `npm start`
2. `node server/main.js`
### Running the dapp.
0. `embark run`

View File

@ -46,8 +46,7 @@ class App extends React.Component {
async redirectIfProcessed(code){
const sentToAddress = await SNTGiveaway.methods.sentToAddress(web3.eth.defaultAccount).call();
const usedCode = await SNTGiveaway.methods.codeUsed( '0x' + code,).call();
if(sentToAddress || usedCode){
if(sentToAddress && usedCode){
this.setState({showENSLink: true});
}
}
@ -94,12 +93,11 @@ class App extends React.Component {
}
const response = await axios.post('http://localhost:3000/requestFunds/', record);
console.log(response);
if(response.data.error){
this.setState({error: true, errorMessage: response.data.message});
}
// TODO: avoid people spamming with localstorage
} else {
console.log("Transaction already exists");
}
setInterval(async () => {
@ -119,7 +117,7 @@ class App extends React.Component {
{ !ready && !error && <h2>Add a loading message / indicator that the dapp is checking whether the code is valid or not </h2> }
{ ready && !showENSLink && <h2>Add a message indicating that the code has been received, and we're processing the trx</h2> }
{ ready && !error && !showENSLink && <h2>Add a message indicating that the code has been received, and we're processing the trx</h2> }
{ showENSLink && !error && <h2>Show link or redirect to ENS DAPP</h2> }
</Fragment>