mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
remove fileInfo check, cleanup (#689)
Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
parent
e02babf2c2
commit
04d505da42
@ -11,7 +11,7 @@ import Trade from './Trade'
|
||||
import { useAsset } from '../../../providers/Asset'
|
||||
import { useOcean } from '../../../providers/Ocean'
|
||||
import { useWeb3 } from '../../../providers/Web3'
|
||||
import { getFileInfo } from '../../../utils/provider'
|
||||
import { fileinfo, getFileInfo } from '../../../utils/provider'
|
||||
import axios from 'axios'
|
||||
|
||||
export default function AssetActions(): ReactElement {
|
||||
@ -26,24 +26,27 @@ export default function AssetActions(): ReactElement {
|
||||
const isCompute = Boolean(ddo?.findServiceByType('compute'))
|
||||
|
||||
useEffect(() => {
|
||||
if (!config) return
|
||||
const source = axios.CancelToken.source()
|
||||
async function initFileInfo() {
|
||||
setFileIsLoading(true)
|
||||
try {
|
||||
const fileInfo = await getFileInfo(
|
||||
DID.parse(`${ddo.id}`),
|
||||
config.providerUri,
|
||||
source.token
|
||||
)
|
||||
setFileMetadata(fileInfo.data[0])
|
||||
} catch (error) {
|
||||
Logger.error(error.message)
|
||||
} finally {
|
||||
setFileIsLoading(false)
|
||||
}
|
||||
}
|
||||
initFileInfo()
|
||||
const { attributes } = ddo.findServiceByType('metadata')
|
||||
setFileMetadata(attributes.main.files[0])
|
||||
// !!!!! do not remove this, we will enable this again after fileInfo endpoint is fixed !!!
|
||||
// if (!config) return
|
||||
// const source = axios.CancelToken.source()
|
||||
// async function initFileInfo() {
|
||||
// setFileIsLoading(true)
|
||||
// try {
|
||||
// const fileInfo = await getFileInfo(
|
||||
// DID.parse(`${ddo.id}`),
|
||||
// config.providerUri,
|
||||
// source.token
|
||||
// )
|
||||
// setFileMetadata(fileInfo.data[0])
|
||||
// } catch (error) {
|
||||
// Logger.error(error.message)
|
||||
// } finally {
|
||||
// setFileIsLoading(false)
|
||||
// }
|
||||
// }
|
||||
// initFileInfo()
|
||||
}, [config, ddo.id])
|
||||
|
||||
// Get and set user DT balance
|
||||
|
@ -1,6 +1,8 @@
|
||||
const cleanupContentType = (contentType: string): string => {
|
||||
// strip away the `charset=utf-8`
|
||||
const contentSplit = contentType.split(';')[0]
|
||||
// strip away the 'application/' part
|
||||
const contentTypeSplit = contentType.split('/')[1]
|
||||
const contentTypeSplit = contentSplit.split('/')[1]
|
||||
|
||||
if (!contentTypeSplit) return contentType
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user