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

message output

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

View File

@ -1,3 +1,5 @@
/* eslint-disable no-console */
import { useEffect, useState } from 'react'
import ipfsClient from 'ipfs-http-client'
@ -19,10 +21,14 @@ export default function useIpfsApi(config: {
if (ipfs) return
try {
const message = 'Connected to IPFS gateway'
console.time(message)
ipfs = await ipfsClient(config)
console.timeEnd(message)
ipfsMessage = message
const version = await ipfs.version()
ipfsVersion = version.version
ipfsMessage = 'Connected to IPFS gateway'
} catch (error) {
setIpfsError(error.message)
}