Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chanatpakorn/joh-77-sprint-5-api-pets-info-petsid-query #57

Merged

Conversation

ChanatpakornS
Copy link
Member

QUERY !!!

Copy link

linear bot commented Feb 19, 2024

Copy link

vercel bot commented Feb 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
johnjud-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2024 3:54pm

Copy link
Member

@boomchanotai boomchanotai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback อ่ะ เอาแค่ Fallback Component Details พอ เพราะว่าถ้า data โหลดเสร็จ ทุก component ใน Details ก็ใช้ได้พร้อมกันหมด

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ใส่ function ไว้ที่ไฟล์ api/pets.ts

Comment on lines 15 to 17
{petData && (
<Details isLoading={petDataLoading} isAdmin={true} data={petData} />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ทำแบบนี้ไปก็ไม่ได้ประโยชน์อะไน เพราะว่ามันรอ petData โหลดเสร็จแล้วค่อย Render ลองดูที่กูเขียนหน้าอื่นๆดู

  1. ไม่ต้อง petData &&
  2. แล้วไป set props type ให้ data เป็น Pet | undefined

{petData && (
<Details isLoading={petDataLoading} isAdmin={true} data={petData} />
)}
{data && <SmallPetCardList isLoading={isLoading} pets={data.pets} />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one Same

src/components/Admin/Pets/Add/DateInputInfo.tsx Outdated Show resolved Hide resolved
Comment on lines 12 to 13
type: "dog" | "cat" | "-";
gender: "male" | "female" | "-";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ลอง cast type ให้มันเป็น dog | cat | - เหมือนเดิมได้ไหม

src/components/Pets/Details/Details.tsx Outdated Show resolved Hide resolved
@@ -39,7 +43,7 @@ const Details = ({

return (
<>
<BigPetCard isAdmin={isAdmin} />
<BigPetCard isLoading={isLoading} isAdmin={isAdmin} data={data} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ไม่ต้อง pass isLoading ไปที่ Details แล้วดิ เพราะว่าให้ Component Details มัน แปะ Fallback แทน

src/components/Pets/PetThumbnails/index.tsx Outdated Show resolved Hide resolved
pets,
}: {
isLoading: boolean;
pets: Pet[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

เปลี่ยนเป็น pets | undefined

src/app/admin/pets/add/page.tsx Outdated Show resolved Hide resolved
@ChanatpakornS
Copy link
Member Author

  • A minor change fallback
  • change type back
    type: "dog" | "cat" | "-"
    gender: "male" | "female" | "-"

@ChanatpakornS ChanatpakornS merged commit 4f20589 into dev Feb 20, 2024
3 checks passed
@ChanatpakornS ChanatpakornS deleted the chanatpakorn/joh-77-sprint-5-api-pets-info-petsid-query branch February 20, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants