Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a64e93

Browse files
committed
Add fetch to the assignment
1 parent c351f9d commit 4a64e93

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"editor.detectIndentation": false,
66
"editor.tabSize": 2,
77
"cSpell.words": [
8+
"networkidle",
89
"tabindex"
910
]
1011
}

Week3/MAKEME.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,26 @@ The homework for week 3 will build on the work you did in week 2. You will creat
3737

3838
This week you will work with all JavaScript files in the `src` folder. The assignment consists of two parts:
3939

40-
1. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`.
41-
2. Make your app ARIA-compliant (see below).
42-
3. Refactor your application to use ES6 classes.
40+
1. Replace `XMLHttpRequest` with the `fetch` API.
41+
2. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`.
42+
3. Make your app ARIA-compliant (see below).
43+
4. Refactor your application to use ES6 classes.
44+
45+
#### 2.2.1 Replace XMLHttpRequest with fetch
46+
47+
Replace `XMLHttpRequest` in the `fetchJSON` function with `fetch`. Because `fetch` returns a promise out of the box there is no need create a promise yourself with `new Promise(...)`.
48+
49+
> `fetch` does not throw an error for HTTP errors. Review the documentation for [`response.ok`](https://developer.mozilla.org/en-US/docs/Web/API/Response/ok) for a clue how detect HTTP errors.
4350
44-
#### 2.2.1 async/await
51+
#### 2.2.2 async/await
4552

4653
**Instructions:**
4754

4855
1. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`.
4956

5057
2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub.
5158

52-
#### 2.2.2 ES6 Classes
59+
#### 2.2.3 ES6 Classes
5360

5461
**_Deadline Saturday_**
5562

@@ -74,13 +81,13 @@ _Read:_
7481
- HYF fundamental: [ES6 Classes](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/oop_classes.md#es6-classes)
7582
- More on ES6 classes: [ES6 Classes in Depth](https://ponyfoo.com/articles/es6-classes-in-depth)
7683

77-
#### 2.2.3 ARIA-compliance (BONUS)
84+
#### 2.2.4 ARIA-compliance (BONUS)
7885

7986
Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria).
8087

8188
For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse.
8289

83-
#### 2.2.4 Handing in your homework
90+
#### 2.2.5 Handing in your homework
8491

8592
If necessary, review the instructions how to [Hand in homework](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md) using GitHub pull request.
8693

0 commit comments

Comments
 (0)