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
|
||||
// -----------------------------------
|
||||
const fetchAccessDetails = useCallback(async (): Promise<void> => {
|
||||
if (!asset?.chainId || !asset?.services) return
|
||||
if (!asset?.chainId || !asset?.services?.length) return
|
||||
|
||||
const accessDetails = await getAccessDetails(
|
||||
asset.chainId,
|
||||
|
@ -58,7 +58,7 @@ export default function AssetTeaser({
|
||||
{removeMarkdown(description?.substring(0, 300) || '')}
|
||||
</Dotdotdot>
|
||||
</div>
|
||||
{isUnsupportedPricing ? (
|
||||
{isUnsupportedPricing || !asset.services.length ? (
|
||||
<strong>No pricing schema available</strong>
|
||||
) : (
|
||||
<Price accessDetails={asset.accessDetails} size="small" />
|
||||
|
@ -30,9 +30,9 @@ export default function FileIcon({
|
||||
|
||||
return (
|
||||
<ul className={styleClasses}>
|
||||
{!isLoading && file ? (
|
||||
{!isLoading ? (
|
||||
<>
|
||||
{file.contentType || file.contentLength ? (
|
||||
{file?.contentType || file?.contentLength ? (
|
||||
<>
|
||||
<li>{cleanupContentType(file.contentType)}</li>
|
||||
<li>
|
||||
|
@ -173,7 +173,7 @@ export default function Download({
|
||||
dtSymbol={asset?.datatokens[0]?.symbol}
|
||||
dtBalance={dtBalance}
|
||||
onClick={handleOrderOrDownload}
|
||||
assetTimeout={secondsToString(asset.services[0].timeout)}
|
||||
assetTimeout={secondsToString(asset?.services?.[0]?.timeout)}
|
||||
assetType={asset?.metadata?.type}
|
||||
stepText={statusText}
|
||||
isLoading={isLoading}
|
||||
@ -195,7 +195,7 @@ export default function Download({
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{isUnsupportedPricing ? (
|
||||
{isUnsupportedPricing || !asset.services.length ? (
|
||||
<Alert
|
||||
className={styles.fieldWarning}
|
||||
state="info"
|
||||
|
@ -30,8 +30,8 @@ export default function MetaAsset({
|
||||
networkId={asset?.chainId}
|
||||
path={
|
||||
isBlockscoutExplorer
|
||||
? `tokens/${asset?.services[0].datatokenAddress}`
|
||||
: `token/${asset?.services[0].datatokenAddress}`
|
||||
? `tokens/${asset?.services?.[0]?.datatokenAddress}`
|
||||
: `token/${asset?.services?.[0]?.datatokenAddress}`
|
||||
}
|
||||
>
|
||||
{`Accessed with ${dataTokenSymbol}`}
|
||||
|
Loading…
Reference in New Issue
Block a user