Fix TypeScript errors in card data sources - change null to undefined for price fields
This commit is contained in:
parent
d21394d579
commit
2f215da3ca
2 changed files with 11 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { tcgApi } from '../../services/tcgApi';
|
||||
|
||||
import cardDataService from '../../services/cardDataSources';
|
||||
import type { Card } from '../../types';
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ export const mtgService = {
|
|||
toughness: card.toughness,
|
||||
image_url: card.image_uris?.normal,
|
||||
stock_image_url: card.image_uris?.normal,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
|
||||
verified: true,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
|
@ -113,8 +113,8 @@ export const mtgService = {
|
|||
toughness: card.toughness,
|
||||
image_url: card.image_uris?.normal,
|
||||
stock_image_url: card.image_uris?.normal,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
|
||||
verified: true,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
|
@ -155,8 +155,8 @@ export const mtgService = {
|
|||
toughness: card.toughness,
|
||||
image_url: card.image_uris?.normal,
|
||||
stock_image_url: card.image_uris?.normal,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null,
|
||||
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
|
||||
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
|
||||
verified: true,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
|
@ -204,8 +204,8 @@ export const pokemonService = {
|
|||
toughness: null,
|
||||
image_url: card.images.small,
|
||||
stock_image_url: card.images.large,
|
||||
current_price: card.cardmarket?.prices?.averageSellPrice || null,
|
||||
market_price: card.cardmarket?.prices?.lowPrice || null,
|
||||
current_price: card.cardmarket?.prices?.averageSellPrice || undefined,
|
||||
market_price: card.cardmarket?.prices?.lowPrice || undefined,
|
||||
verified: true,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
|
@ -256,8 +256,8 @@ export const yugiohService = {
|
|||
toughness: card.def?.toString(),
|
||||
image_url: card.card_images?.[0]?.image_url,
|
||||
stock_image_url: card.card_images?.[0]?.image_url_small,
|
||||
current_price: card.card_prices?.[0]?.amazon_price ? parseFloat(card.card_prices[0].amazon_price) : null,
|
||||
market_price: card.card_prices?.[0]?.cardmarket_price ? parseFloat(card.card_prices[0].cardmarket_price) : null,
|
||||
current_price: card.card_prices?.[0]?.amazon_price ? parseFloat(card.card_prices[0].amazon_price) : undefined,
|
||||
market_price: card.card_prices?.[0]?.cardmarket_price ? parseFloat(card.card_prices[0].cardmarket_price) : undefined,
|
||||
verified: true,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue