Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1ff61a909 |
@@ -71,10 +71,18 @@ export function PetProfiles({ sessionId, readOnly }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const petsData = await petsRes.json();
|
const petsData = await petsRes.json();
|
||||||
const apptsData: AppointmentsResponse = await apptsRes.json();
|
const apptsData = await apptsRes.json();
|
||||||
|
|
||||||
setPets(petsData);
|
setPets(petsData.map((p: { id: string; name: string; breed: string; weightKg: number; dateOfBirth: string; photoKey: string | null; groomingNotes: string | null }) => ({
|
||||||
setAppointments(apptsData);
|
id: p.id,
|
||||||
|
name: p.name,
|
||||||
|
breed: p.breed,
|
||||||
|
weight: p.weightKg,
|
||||||
|
birthDate: p.dateOfBirth,
|
||||||
|
photoUrl: p.photoKey ?? null,
|
||||||
|
notes: p.groomingNotes ?? null,
|
||||||
|
})));
|
||||||
|
setAppointments({ upcoming: apptsData?.upcoming || [], past: apptsData?.past || [] });
|
||||||
|
|
||||||
if (petsData.length > 0 && !selectedPetId) {
|
if (petsData.length > 0 && !selectedPetId) {
|
||||||
setSelectedPetId(petsData[0].id);
|
setSelectedPetId(petsData[0].id);
|
||||||
|
|||||||
Reference in New Issue
Block a user