Fix TypeScript errors in card data sources - change null to undefined for price fields

This commit is contained in:
Randall Stillwell 2025-07-22 20:07:28 -05:00
parent d21394d579
commit 2f215da3ca
2 changed files with 11 additions and 11 deletions

View file

@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { tcgApi } from '../../services/tcgApi';
import cardDataService from '../../services/cardDataSources'; import cardDataService from '../../services/cardDataSources';
import type { Card } from '../../types'; import type { Card } from '../../types';

View file

@ -70,8 +70,8 @@ export const mtgService = {
toughness: card.toughness, toughness: card.toughness,
image_url: card.image_uris?.normal, image_url: card.image_uris?.normal,
stock_image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal,
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
verified: true, verified: true,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
@ -113,8 +113,8 @@ export const mtgService = {
toughness: card.toughness, toughness: card.toughness,
image_url: card.image_uris?.normal, image_url: card.image_uris?.normal,
stock_image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal,
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
verified: true, verified: true,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
@ -155,8 +155,8 @@ export const mtgService = {
toughness: card.toughness, toughness: card.toughness,
image_url: card.image_uris?.normal, image_url: card.image_uris?.normal,
stock_image_url: card.image_uris?.normal, stock_image_url: card.image_uris?.normal,
current_price: card.prices?.usd ? parseFloat(card.prices.usd) : null, current_price: card.prices?.usd ? parseFloat(card.prices.usd) : undefined,
market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : null, market_price: card.prices?.usd_foil ? parseFloat(card.prices.usd_foil) : undefined,
verified: true, verified: true,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
@ -204,8 +204,8 @@ export const pokemonService = {
toughness: null, toughness: null,
image_url: card.images.small, image_url: card.images.small,
stock_image_url: card.images.large, stock_image_url: card.images.large,
current_price: card.cardmarket?.prices?.averageSellPrice || null, current_price: card.cardmarket?.prices?.averageSellPrice || undefined,
market_price: card.cardmarket?.prices?.lowPrice || null, market_price: card.cardmarket?.prices?.lowPrice || undefined,
verified: true, verified: true,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
@ -256,8 +256,8 @@ export const yugiohService = {
toughness: card.def?.toString(), toughness: card.def?.toString(),
image_url: card.card_images?.[0]?.image_url, image_url: card.card_images?.[0]?.image_url,
stock_image_url: card.card_images?.[0]?.image_url_small, 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, 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) : null, market_price: card.card_prices?.[0]?.cardmarket_price ? parseFloat(card.card_prices[0].cardmarket_price) : undefined,
verified: true, verified: true,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),