Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixed for reward-dist #1857

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ export default {
},
handleEventActionUpdate() {
// Code to update an Action
const data = {...this.prizeDetails}
if(data.hasOwnProperty('isDistributed') && data.isDistributed=== true) {
return this.notifyErr('Reward has been distributed for this prize you cannot edit it!')
}
let isvalid = this.handleEventActionValidation();
if (isvalid) {
this.selected.value = JSON.stringify(this.prizeDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ export default {
const returnOldTreeId = Number(oldTreeId) + 1
return returnOldTreeId
} catch (e) {
throw new Error(e)
throw new Error(e.message)
}
},
prizeCardSelectedForAirdrop(prize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export default {
throw new Error("Reward already claimed");
}
} catch (e) {
this.notifyErr(e);
this.notifyErr(e.message);
} finally {
this.isLoading = false;
}
Expand Down
14 changes: 10 additions & 4 deletions src/mixins/getWeb3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Web3 from 'web3'

async function loadWeb3(inDecimal) {
async function loadWeb3(inDecimal) {
try{

if(window.ethereum){
const chain = Web3.utils.toHex(inDecimal);
window.web3 = new Web3(window.ethereum);
Expand Down Expand Up @@ -83,14 +85,18 @@ async function loadWeb3(inDecimal) {
}
}
}
await window.ethereum.request({ method: "eth_requestAccounts" });
return window.web3;
}else if(window.web3){
await window.ethereum.request({ method: "eth_requestAccounts" });
return window.web3;

}else if(window.web3){
window.web3 = new Web3(window.web3.currentProvider);
return window.web3;
}else{
throw new Error("Install Metamask browser extention");
}
}catch(e) {
throw new Error(e)
}
}

export default loadWeb3;