Add beer search feature

This commit adds the necessary components and hooks to implement a beer search feature on the website. It includes the following changes:

- Add a new BeerSearch API route that returns a list of beers matching a search query.
-  Implement a new hook useBeerPostSearch that utilizes SWR to fetch data from the API and parse it using a schema.
- Add a new page SearchPage that displays a search input field and a list of beer search results.
- Use lodash's debounce function to avoid making too many requests while the user is typing in the search input field.
This commit is contained in:
Aaron William Po
2023-03-27 19:01:51 -04:00
parent 7194f140aa
commit 2efc506250
6 changed files with 195 additions and 25 deletions

View File

@@ -23,20 +23,21 @@
"cookie": "0.5.0",
"date-fns": "^2.29.3",
"jsonwebtoken": "^9.0.0",
"multer-storage-cloudinary": "^4.0.0",
"lodash": "^4.17.21",
"multer": "^2.0.0-rc.4",
"next-connect": "^1.0.0-next.3",
"multer-storage-cloudinary": "^4.0.0",
"next": "^13.2.1",
"passport-local": "^1.0.0",
"next-connect": "^1.0.0-next.3",
"passport": "^0.6.0",
"pino-pretty": "^9.3.0",
"passport-local": "^1.0.0",
"pino": "^8.11.0",
"pino-pretty": "^9.3.0",
"react": "18.2.0",
"react-daisyui": "^3.0.3",
"react-dom": "18.2.0",
"react-email": "^1.7.15",
"react-hook-form": "^7.43.2",
"react-icons": "^4.7.1",
"react": "18.2.0",
"sparkpost": "^2.1.4",
"swr": "^2.0.3",
"zod": "^3.20.6"
@@ -46,6 +47,7 @@
"@types/cookie": "^0.5.1",
"@types/ejs": "^3.1.2",
"@types/jsonwebtoken": "^9.0.1",
"@types/lodash": "^4.14.191",
"@types/multer": "^1.4.7",
"@types/node": "^18.14.1",
"@types/passport-local": "^1.0.35",