Initial fix
This commit is contained in:
18
common.js
18
common.js
@ -40,16 +40,26 @@ async function getAssetInfo(assetId) {
|
||||
|
||||
const data = res.data.data;
|
||||
const assetInfo = data[0];
|
||||
|
||||
let isFree, forSale;
|
||||
if (assetInfo.fiatProduct) {
|
||||
const quantity = assetInfo.fiatProduct.purchasePrice.quantity;
|
||||
isFree = quantity.significand === 0 && quantity.exponent === 0;
|
||||
forSale = assetInfo.fiatProduct.published && assetInfo.fiatProduct.purchasable;
|
||||
}
|
||||
else {
|
||||
isFree = assetInfo.product.price === 0;
|
||||
forSale = assetInfo.product.isForSaleOrIsPublicDomain;
|
||||
}
|
||||
console.log(assetInfo);
|
||||
|
||||
return {
|
||||
status: res.status,
|
||||
id: assetId,
|
||||
name: assetInfo.asset.name,
|
||||
typeId: assetInfo.asset.typeId,
|
||||
creatorId: assetInfo.creator.id,
|
||||
price: assetInfo.product.price,
|
||||
productId: assetInfo.product.productId,
|
||||
forSale: assetInfo.product.isForSaleOrIsPublicDomain
|
||||
isFree: isFree,
|
||||
forSale: forSale
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user