1
0
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:
mihaisc 2021-06-16 19:49:40 +03:00 committed by GitHub
parent e02babf2c2
commit 04d505da42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 20 deletions

View File

@ -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

View File

@ -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