mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Ensuring the market doesn't crash when asset has no services (#1768)
* Ensuring the market doesn't crash when asset has no services * Showing no pricing schema available when there are no services for an asset * Shoing No file info available when there are no services available * removing logs * early return if asset has no services
This commit is contained in:
parent
c780411b74
commit
a042387804
@ -120,7 +120,7 @@ function AssetProvider({
|
|||||||
// Helper: Get and set asset access details
|
// Helper: Get and set asset access details
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
const fetchAccessDetails = useCallback(async (): Promise<void> => {
|
const fetchAccessDetails = useCallback(async (): Promise<void> => {
|
||||||
if (!asset?.chainId || !asset?.services) return
|
if (!asset?.chainId || !asset?.services?.length) return
|
||||||
|
|
||||||
const accessDetails = await getAccessDetails(
|
const accessDetails = await getAccessDetails(
|
||||||
asset.chainId,
|
asset.chainId,
|
||||||
|
@ -58,7 +58,7 @@ export default function AssetTeaser({
|
|||||||
{removeMarkdown(description?.substring(0, 300) || '')}
|
{removeMarkdown(description?.substring(0, 300) || '')}
|
||||||
</Dotdotdot>
|
</Dotdotdot>
|
||||||
</div>
|
</div>
|
||||||
{isUnsupportedPricing ? (
|
{isUnsupportedPricing || !asset.services.length ? (
|
||||||
<strong>No pricing schema available</strong>
|
<strong>No pricing schema available</strong>
|
||||||
) : (
|
) : (
|
||||||
<Price accessDetails={asset.accessDetails} size="small" />
|
<Price accessDetails={asset.accessDetails} size="small" />
|
||||||
|
@ -30,9 +30,9 @@ export default function FileIcon({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className={styleClasses}>
|
<ul className={styleClasses}>
|
||||||
{!isLoading && file ? (
|
{!isLoading ? (
|
||||||
<>
|
<>
|
||||||
{file.contentType || file.contentLength ? (
|
{file?.contentType || file?.contentLength ? (
|
||||||
<>
|
<>
|
||||||
<li>{cleanupContentType(file.contentType)}</li>
|
<li>{cleanupContentType(file.contentType)}</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -173,7 +173,7 @@ export default function Download({
|
|||||||
dtSymbol={asset?.datatokens[0]?.symbol}
|
dtSymbol={asset?.datatokens[0]?.symbol}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
onClick={handleOrderOrDownload}
|
onClick={handleOrderOrDownload}
|
||||||
assetTimeout={secondsToString(asset.services[0].timeout)}
|
assetTimeout={secondsToString(asset?.services?.[0]?.timeout)}
|
||||||
assetType={asset?.metadata?.type}
|
assetType={asset?.metadata?.type}
|
||||||
stepText={statusText}
|
stepText={statusText}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
@ -195,7 +195,7 @@ export default function Download({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{isUnsupportedPricing ? (
|
{isUnsupportedPricing || !asset.services.length ? (
|
||||||
<Alert
|
<Alert
|
||||||
className={styles.fieldWarning}
|
className={styles.fieldWarning}
|
||||||
state="info"
|
state="info"
|
||||||
|
@ -30,8 +30,8 @@ export default function MetaAsset({
|
|||||||
networkId={asset?.chainId}
|
networkId={asset?.chainId}
|
||||||
path={
|
path={
|
||||||
isBlockscoutExplorer
|
isBlockscoutExplorer
|
||||||
? `tokens/${asset?.services[0].datatokenAddress}`
|
? `tokens/${asset?.services?.[0]?.datatokenAddress}`
|
||||||
: `token/${asset?.services[0].datatokenAddress}`
|
: `token/${asset?.services?.[0]?.datatokenAddress}`
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{`Accessed with ${dataTokenSymbol}`}
|
{`Accessed with ${dataTokenSymbol}`}
|
||||||
|
Loading…
Reference in New Issue
Block a user