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:
parent
955608202d
commit
a258f6b94b
@ -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 }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user