1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

try getting title earlier

This commit is contained in:
Matthias Kretschmann 2020-09-14 16:56:27 +02:00
parent 32ca88bea9
commit 2761a615b9
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 5 additions and 3 deletions

View File

@ -2,11 +2,11 @@ import React, { useState, useEffect, ReactElement } from 'react'
import { Router } from '@reach/router'
import AssetContent from '../../components/organisms/AssetContent'
import Layout from '../../components/Layout'
import { MetadataMarket, ServiceMetadataMarket } from '../../@types/Metadata'
import { MetadataMarket } from '../../@types/Metadata'
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
import Alert from '../../components/atoms/Alert'
import Loader from '../../components/atoms/Loader'
import { useOcean } from '@oceanprotocol/react'
import { useOcean, useMetadata } from '@oceanprotocol/react'
export default function PageTemplateAssetDetails({
did,
@ -16,6 +16,7 @@ export default function PageTemplateAssetDetails({
uri: string
}): ReactElement {
const { config } = useOcean()
const metadataMinimal = useMetadata(did)
const [metadata, setMetadata] = useState<MetadataMarket>()
const [title, setTitle] = useState<string>()
const [error, setError] = useState<string>()
@ -61,7 +62,7 @@ export default function PageTemplateAssetDetails({
<Alert title={title} text={error} state="error" />
</Layout>
) : (
<Layout title="Loading..." uri={uri}>
<Layout title={metadataMinimal.title} uri={uri}>
<Loader />
</Layout>
)

View File

@ -4,5 +4,6 @@ import PageTemplateAssetDetails from '../../components/templates/AssetDetails'
export default function PageGatsbyAssetDetails(props: PageProps): ReactElement {
const did = props.location.pathname.split('/')[2]
return <PageTemplateAssetDetails did={did} uri={props.location.pathname} />
}