fix web3/config error

This commit is contained in:
Andrea Franz 2020-03-31 12:40:24 +02:00
parent 5c51dcc1d8
commit 3fbbffca65
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 8 additions and 4 deletions

View File

@ -84,7 +84,7 @@ export const initializeWeb3 = () => {
} }
dispatch(web3NetworkIDLoaded(id)) dispatch(web3NetworkIDLoaded(id))
dispatch(loadAddress()); dispatch<any>(loadAddress());
}); });
}) })
.catch((err: string) => { .catch((err: string) => {
@ -96,7 +96,7 @@ export const initializeWeb3 = () => {
dispatch(web3Initialized(t)); dispatch(web3Initialized(t));
config.web3!.eth.net.getId().then((id: number) => { config.web3!.eth.net.getId().then((id: number) => {
dispatch(web3NetworkIDLoaded(id)) dispatch(web3NetworkIDLoaded(id))
dispatch(loadAddress()); dispatch<any>(loadAddress());
}) })
.catch((err: string) => { .catch((err: string) => {
//FIXME: handle error //FIXME: handle error
@ -110,7 +110,7 @@ export const initializeWeb3 = () => {
const loadAddress = () => { const loadAddress = () => {
return (dispatch: Dispatch, getState: () => RootState) => { return (dispatch: Dispatch, getState: () => RootState) => {
web3.eth.getAccounts().then((accounts: string[]) => { config.web3!.eth.getAccounts().then((accounts: string[]) => {
dispatch(accountLoaded(accounts[0])); dispatch(accountLoaded(accounts[0]));
}); });
}; };

View File

@ -1,7 +1,11 @@
import Web3 from "web3"; import Web3 from "web3";
export const config = { export interface Config {
web3: Web3 | undefined web3: Web3 | undefined
}
export const config: Config = {
web3: undefined
}; };
export const redeemPath = "/redeem/:bucketAddress/:recipientAddress"; export const redeemPath = "/redeem/:bucketAddress/:recipientAddress";