Conversation
📝 HackYourFuture auto gradeAssignment Score: 100 / 100 ✅Status: ✅ Passed Test Details |
| try { | ||
| // 1. Fetch data from the API at the given URL | ||
|
|
||
| const responce = await fetch(url); |
| throw new Error("not ok" + responce.status); | ||
| } | ||
| const data = await responce.json(); | ||
| console.log(JSON.stringify(data.drinks[0], null, 2)); |
There was a problem hiding this comment.
Debug console.logs should be deleted from the file when the development is finished.
| } | ||
|
|
||
| function generateMarkdown(data) { | ||
| const drinks = data.drinks; |
There was a problem hiding this comment.
If drinks returned null , the function will still try to for...of over null, which will throw a TypeError.
|
|
||
| function generateDrinkMarkdown(drink) { | ||
| return ` | ||
|
|
There was a problem hiding this comment.
These empty lines are visible in the markdown
| throw new Error( | ||
| `Failed to delete post: HTTP ${response.status} ${response.statusText}`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
The function doesn't return the response body
| throw new Error( | ||
| `Failed to delete post: HTTP ${response.status} ${response.statusText}`, | ||
| ); | ||
| } |
| @@ -54,6 +54,18 @@ const getHello = async () => { | |||
| */ | |||
| const getMe = async () => { | |||
| // TODO | |||
There was a problem hiding this comment.
//TODO comments should be deleted after development finish
|
|
||
| if (!response.ok) { | ||
| throw new Error( | ||
| `Failed to get hello: HTTP ${response.status} ${response.statusText}`, |
There was a problem hiding this comment.
The error here is not about Hello, it's about me
| }); | ||
| if (!response.ok) { | ||
| throw new Error( | ||
| `Failed to delete post: HTTP ${response.status} ${response.statusText}`, |
There was a problem hiding this comment.
The error is about deleting a user, not a post
No description provided.