mirageruler / df-frontend-2023

learning FE stuffs from dwarves
https://df-frontend-2023-rust.vercel.app
0 stars 1 forks source link

Submission for assignment 6 #6

Open mirageruler opened 1 year ago

mirageruler commented 1 year ago
tienan92it commented 1 year ago

Hello @mirageruler , well done! Below is some feedback for your assignment.

Requirements

Final result: ✅ passed 80% of requirements

Feedback

  1. It's better to retrieve api BASE_URL from .env file. https://github.com/mirageruler/df-frontend-2023/blob/92d13c4b62dfec60c9180bfa8a567f0c1b5d97dd/assignment-6/src/constant.tsx#L10

  2. Should return error instead of boolean to handle form errors. https://github.com/mirageruler/df-frontend-2023/blob/92d13c4b62dfec60c9180bfa8a567f0c1b5d97dd/assignment-6/src/services/auth.ts#L18-L32

  3. Create / Edit book call the same API -> a new book is created when submit Edit form. https://github.com/mirageruler/df-frontend-2023/blob/92d13c4b62dfec60c9180bfa8a567f0c1b5d97dd/assignment-6/src/components/BookStore.tsx#L101

  4. Should handle Auth by Context. It helps to access Auth states crossing the app. https://github.com/mirageruler/df-frontend-2023/blob/92d13c4b62dfec60c9180bfa8a567f0c1b5d97dd/assignment-6/src/components/Layout.tsx#L16-L26

  5. Sometime after a book is deleted in detail page and go back to book list, the book list is out of date due to SWR caching. Should revalidate book list after there are any changes. https://github.com/mirageruler/df-frontend-2023/blob/92d13c4b62dfec60c9180bfa8a567f0c1b5d97dd/assignment-6/src/app/book/%5Bid%5D/page.tsx#L33-L34