Closed NwinNwin closed 8 months ago
leaderboard/
items/
We are currently are using a SQL query that is retrieving all the data with *
*
We want to retrieve everything but the user’s emails!!
In backend → routes/items.js
backend → routes/items.js
Replace the SQL query in the GET “/” request to retrieve everything except the email
GET “/”
Create a new GET request that takes in a item id and retrieves back ONLY the email associated with this item id
GET request
Use middleware.decodeToken to verify if they logged in
middleware.decodeToken
- Example (backend --> routes/items.js):
When a user clicks on View Contact on an item, make a request call to the new route that you just created, passing in the current item id
View Contact
Use Authorization in headers to pass in authentication token when making API call to bypass backend’s middleware
Authorization
An example is in component/InfoModal.jsx
component/InfoModal.jsx
How to find the bug:
leaderboard/
anditems/
Why is this:
We are currently are using a SQL query that is retrieving all the data with
*
We want to retrieve everything but the user’s emails!!
How To Fix:
In
backend → routes/items.js
Replace the SQL query in the
GET “/”
request to retrieve everything except the emailCreate a new
GET request
that takes in a item id and retrieves back ONLY the email associated with this item idUse
middleware.decodeToken
to verify if they logged in- Example (backend --> routes/items.js):
When a user clicks on
View Contact
on an item, make a request call to the new route that you just created, passing in the current item idUse
Authorization
in headers to pass in authentication token when making API call to bypass backend’s middlewareAn example is in
component/InfoModal.jsx