years-to-read icon indicating copy to clipboard operation
years-to-read copied to clipboard

Show proper message if api request is forbidden (403 status)

Open devfake opened this issue 7 years ago • 1 comments

It could be the case, that the API volume of Google Books is exhausted. The response will return a 403 status code.

I updated the backend and return this status to the client (https://github.com/devfake/years-to-read/commit/0d6591402df4ccc14155bcb9f14a0ccec1509423).

What we need now is to display a message in the frontend. The best thing we can do is create a new variable, and set it to true if the response is a 403. And show a proper message in the template, similiar to the Nothing found :( span.

To test this, you can replace the line 24 in express.js instead of res.json(formattedData) with res.json(forbiddenResponse()).

Bonus point: Move the hardcodet status codes (404 for example) to own constants on top of the script (:

devfake avatar Aug 18 '18 21:08 devfake

Hey I would love to work on this issue! Could you assign me to it?

ccmetz avatar Oct 01 '18 21:10 ccmetz