FIxing showing ENS section conditions
This commit is contained in:
parent
139c8f1527
commit
594e4f3e96
|
@ -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
|
A nodejs service was created to receive funding requests. It requires a geth light node to run
|
||||||
0. `chmod 600 server/config.js`
|
0. `chmod 600 server/config.js`
|
||||||
1. Edit `server/config.js` and set the contract address and the private key of the controller address.
|
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.
|
### Running the dapp.
|
||||||
0. `embark run`
|
0. `embark run`
|
||||||
|
|
|
@ -46,8 +46,7 @@ class App extends React.Component {
|
||||||
async redirectIfProcessed(code){
|
async redirectIfProcessed(code){
|
||||||
const sentToAddress = await SNTGiveaway.methods.sentToAddress(web3.eth.defaultAccount).call();
|
const sentToAddress = await SNTGiveaway.methods.sentToAddress(web3.eth.defaultAccount).call();
|
||||||
const usedCode = await SNTGiveaway.methods.codeUsed( '0x' + code,).call();
|
const usedCode = await SNTGiveaway.methods.codeUsed( '0x' + code,).call();
|
||||||
|
if(sentToAddress && usedCode){
|
||||||
if(sentToAddress || usedCode){
|
|
||||||
this.setState({showENSLink: true});
|
this.setState({showENSLink: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,12 +93,11 @@ class App extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await axios.post('http://localhost:3000/requestFunds/', record);
|
const response = await axios.post('http://localhost:3000/requestFunds/', record);
|
||||||
|
if(response.data.error){
|
||||||
console.log(response);
|
this.setState({error: true, errorMessage: response.data.message});
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: avoid people spamming with localstorage
|
// TODO: avoid people spamming with localstorage
|
||||||
} else {
|
|
||||||
console.log("Transaction already exists");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(async () => {
|
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 && !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> }
|
{ showENSLink && !error && <h2>Show link or redirect to ENS DAPP</h2> }
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
Loading…
Reference in New Issue