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:
parent
32ca88bea9
commit
2761a615b9
@ -2,11 +2,11 @@ import React, { useState, useEffect, ReactElement } from 'react'
|
|||||||
import { Router } from '@reach/router'
|
import { Router } from '@reach/router'
|
||||||
import AssetContent from '../../components/organisms/AssetContent'
|
import AssetContent from '../../components/organisms/AssetContent'
|
||||||
import Layout from '../../components/Layout'
|
import Layout from '../../components/Layout'
|
||||||
import { MetadataMarket, ServiceMetadataMarket } from '../../@types/Metadata'
|
import { MetadataMarket } from '../../@types/Metadata'
|
||||||
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
|
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
|
||||||
import Alert from '../../components/atoms/Alert'
|
import Alert from '../../components/atoms/Alert'
|
||||||
import Loader from '../../components/atoms/Loader'
|
import Loader from '../../components/atoms/Loader'
|
||||||
import { useOcean } from '@oceanprotocol/react'
|
import { useOcean, useMetadata } from '@oceanprotocol/react'
|
||||||
|
|
||||||
export default function PageTemplateAssetDetails({
|
export default function PageTemplateAssetDetails({
|
||||||
did,
|
did,
|
||||||
@ -16,6 +16,7 @@ export default function PageTemplateAssetDetails({
|
|||||||
uri: string
|
uri: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { config } = useOcean()
|
const { config } = useOcean()
|
||||||
|
const metadataMinimal = useMetadata(did)
|
||||||
const [metadata, setMetadata] = useState<MetadataMarket>()
|
const [metadata, setMetadata] = useState<MetadataMarket>()
|
||||||
const [title, setTitle] = useState<string>()
|
const [title, setTitle] = useState<string>()
|
||||||
const [error, setError] = useState<string>()
|
const [error, setError] = useState<string>()
|
||||||
@ -61,7 +62,7 @@ export default function PageTemplateAssetDetails({
|
|||||||
<Alert title={title} text={error} state="error" />
|
<Alert title={title} text={error} state="error" />
|
||||||
</Layout>
|
</Layout>
|
||||||
) : (
|
) : (
|
||||||
<Layout title="Loading..." uri={uri}>
|
<Layout title={metadataMinimal.title} uri={uri}>
|
||||||
<Loader />
|
<Loader />
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
|
@ -4,5 +4,6 @@ import PageTemplateAssetDetails from '../../components/templates/AssetDetails'
|
|||||||
|
|
||||||
export default function PageGatsbyAssetDetails(props: PageProps): ReactElement {
|
export default function PageGatsbyAssetDetails(props: PageProps): ReactElement {
|
||||||
const did = props.location.pathname.split('/')[2]
|
const did = props.location.pathname.split('/')[2]
|
||||||
|
|
||||||
return <PageTemplateAssetDetails did={did} uri={props.location.pathname} />
|
return <PageTemplateAssetDetails did={did} uri={props.location.pathname} />
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user