Open mirageruler opened 1 year ago
Hello @mirageruler , well done! Below is some feedback for your assignment.
Final result: ✅ passed 80% of requirements
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
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
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
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
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