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 [isIpfsReady, setIpfsReady] = useState(Boolean(ipfs))
|
||||||
const [ipfsError, setIpfsError] = useState(null)
|
const [ipfsError, setIpfsError] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
async function initIpfs() {
|
async function initIpfs() {
|
||||||
ipfsMessage = 'Checking IPFS gateway...'
|
ipfsMessage = 'Checking IPFS gateway...'
|
||||||
|
|
||||||
@ -34,8 +35,6 @@ export default function useIpfsApi(config: {
|
|||||||
}
|
}
|
||||||
setIpfsReady(Boolean(ipfs))
|
setIpfsReady(Boolean(ipfs))
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
initIpfs()
|
initIpfs()
|
||||||
|
|
||||||
// just like componentWillUnmount()
|
// just like componentWillUnmount()
|
||||||
@ -48,7 +47,7 @@ export default function useIpfsApi(config: {
|
|||||||
setIpfsError(null)
|
setIpfsError(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [])
|
}, [config])
|
||||||
|
|
||||||
return { ipfs, ipfsVersion, isIpfsReady, ipfsError, ipfsMessage }
|
return { ipfs, ipfsVersion, isIpfsReady, ipfsError, ipfsMessage }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user