set network using flag

this will ensure non web3 browsers can fetch data
This commit is contained in:
Barry Gitarts 2019-08-19 20:49:20 -04:00 committed by Barry G
parent dc7e787353
commit aa044bdacc
3 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@
"compile": "npm run compile:sol && npm run compile:js", "compile": "npm run compile:sol && npm run compile:js",
"lint": "eslint src", "lint": "eslint src",
"start": "node scripts/start.js", "start": "node scripts/start.js",
"ropsten": "REACT_APP_NETWORK=ropsten node scripts/start.js",
"build": "node scripts/build.js" "build": "node scripts/build.js"
}, },
"repository": { "repository": {

View File

@ -181,7 +181,7 @@ function FundProject({ classes, match, history }) {
useEffect(() => { useEffect(() => {
stopPolling() stopPolling()
}, [data.profile]) }, [data])
if (loading) return <Loading /> if (loading) return <Loading />
if (error) return <div>{`Error! ${error.message}`}</div> if (error) return <div>{`Error! ${error.message}`}</div>

View File

@ -1,4 +1,5 @@
/*global web3*/ /*global web3*/
/*global process*/
import React from 'react' import React from 'react'
import { HashRouter as Router } from 'react-router-dom' import { HashRouter as Router } from 'react-router-dom'
import EmbarkJS from './embarkArtifacts/embarkjs' import EmbarkJS from './embarkArtifacts/embarkjs'
@ -31,9 +32,8 @@ class App extends React.Component {
}; };
componentDidMount(){ componentDidMount(){
getNetworkType().then(async network => { const network = process.env.REACT_APP_NETWORK || 'ropsten'
this.setGraphClient(network) this.setGraphClient(network)
})
this.getAndSetPrices() this.getAndSetPrices()
EmbarkJS.onReady(async (err) => { EmbarkJS.onReady(async (err) => {