1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

fix useEffect warning

This commit is contained in:
Matthias Kretschmann 2019-09-06 14:48:49 +02:00
parent 955608202d
commit a258f6b94b
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -15,6 +15,7 @@ export default function useIpfsApi(config: {
const [isIpfsReady, setIpfsReady] = useState(Boolean(ipfs))
const [ipfsError, setIpfsError] = useState(null)
useEffect(() => {
async function initIpfs() {
ipfsMessage = 'Checking IPFS gateway...'
@ -34,8 +35,6 @@ export default function useIpfsApi(config: {
}
setIpfsReady(Boolean(ipfs))
}
useEffect(() => {
initIpfs()
// just like componentWillUnmount()
@ -48,7 +47,7 @@ export default function useIpfsApi(config: {
setIpfsError(null)
}
}
}, [])
}, [config])
return { ipfs, ipfsVersion, isIpfsReady, ipfsError, ipfsMessage }
}