Skip to content

Commit 3ff508f

Browse files
Changes - who cares
1 parent a9c4278 commit 3ff508f

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/others/Globals.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ export abstract class BreedData { }
1414
export class DogBreedData extends BreedData {
1515
breed: string
1616
// bredFor: string[]
17-
heightRangeCM: number[]
18-
lifespanRange: number[]
17+
// heightRangeCM: number[]
18+
// lifespanRange: number[]
1919
// temperament: string[]
2020
// weightKG: number[]
2121

2222
constructor(breedsObj: any) {
23+
console.log("About to construct from this obj: ", breedsObj)
24+
2325
super()
2426
this.breed = breedsObj.breed
2527
// this.bredFor = breedsObj.bred_for.split(",").map((s: string) => s.trim())
26-
this.heightRangeCM = breedsObj.height.metric.split("-").map((h: string) => parseInt(h))
27-
this.lifespanRange = breedsObj.life_span.split("-").map((ls: string) => parseInt(ls))
28+
// this.heightRangeCM = breedsObj.height.metric.split("-").map((h: string) => parseInt(h))
29+
console.log("Dog Height Data: ", breedsObj.height.metric)
30+
// this.lifespanRange = breedsObj.life_span.split("-").map((ls: string) => parseInt(ls))
2831
}
2932
}
3033

@@ -85,8 +88,10 @@ export const Utils = {
8588
return new Date(randomTimestamp);
8689
},
8790
convertToPetApiData(obj: any, apiType: PET_API_TYPE): PetApiData {
91+
console.log(apiType, obj.breeds[0])
8892
return new PetApiData(
89-
obj.id, obj.url,
93+
obj.id, obj.url,
94+
new DogBreedData(obj),
9095
apiType === PET_API_TYPE.DOG ?
9196
new DogBreedData(obj.breeds[0]) :
9297
new CatBreedData(obj.breeds[0]),

src/pages/AdoptionGalleryPage.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@ const AdoptionGalleryPage: React.FC = () => {
1313
const imageCount = Math.ceil(fetchCount / 2)
1414

1515
try {
16-
const catApiRes = await axios.get(
17-
`https://api.thecatapi.com/v1/images/search?has_breeds=1&limit=${imageCount}`, {
18-
headers: { 'x-api-key': import.meta.env.VITE_CAT_API_KEY }
19-
}
20-
)
16+
// const catApiRes = await axios.get(
17+
// `https://api.thecatapi.com/v1/images/search?has_breeds=1&limit=${imageCount}`, {
18+
// headers: { 'x-api-key': import.meta.env.VITE_CAT_API_KEY }
19+
// }
20+
// )
2121
const dogApiRes = await axios.get(
2222
`https://api.thedogapi.com/v1/images/search?has_breeds=1&limit=${imageCount}`, {
2323
headers: { 'x-api-key': import.meta.env.VITE_DOG_API_KEY
2424
}
2525
})
2626

2727
const allPetData = [
28-
...catApiRes.data
29-
.map((obj: any) => Utils.convertToPetApiData(obj, PET_API_TYPE.CAT))
30-
.filter((petData: PetApiData) => !petData.imgURL.endsWith('.gif')),
28+
// ...catApiRes.data
29+
// .map((obj: any) => Utils.convertToPetApiData(obj, PET_API_TYPE.CAT))
30+
// .filter((petData: PetApiData) => !petData.imgURL.endsWith('.gif'))
31+
// ,
3132
...dogApiRes.data
3233
.map((obj: any) => Utils.convertToPetApiData(obj, PET_API_TYPE.DOG))
3334
.filter((petData: PetApiData) => !petData.imgURL.endsWith('.gif'))
@@ -37,10 +38,10 @@ const AdoptionGalleryPage: React.FC = () => {
3738
setPetData(allPetData)
3839
}
3940
catch (err: any) {
40-
console.error("Error fetching from TheCatAPI: ", err.message)
41+
console.error("Error fetching from API: ", err.message)
4142
}
4243
}
43-
fetchPetApiData(6)
44+
fetchPetApiData(1)
4445
}, [])
4546

4647
return (

0 commit comments

Comments
 (0)