Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async componentWillMount() {
let metamask: any;
const currentAddress = await getCurrentAccountAddress();
if (currentAddress) {
console.log(`using address from web3 connection: ${currentAddress}`);
this.props.cookies.set("currentAddress", currentAddress, { path: "/"});
this.props.setCurrentAccount(currentAddress);
} else {
const currentAddressFromCookie = this.props.cookies.get("currentAddress");
if (currentAddressFromCookie) {
console.log(`using address from cookie: ${currentAddressFromCookie}`);
this.props.setCurrentAccount(currentAddressFromCookie);
} else {
this.props.cookies.set("currentAddress", "", { path: "/"});
this.props.setCurrentAccount(undefined);
}
}
try {