Skip to content

Commit 4d7bcc3

Browse files
Fixed polyfill whatwg-fetch in sample 12 and readme file updated
1 parent cbff1ee commit 4d7bcc3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

12_TableHttp/readme.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,23 @@ Install [Node.js and npm](https://nodejs.org/en/) (v6.6.0 or newer) if they are
3434
npm install whatwg-fetch --save-dev
3535
```
3636

37+
- In _webpack.config.js_ let's add the new _whatwg-fetch_ polyfill as entry point:
38+
39+
_webpack.config.js_
40+
41+
```diff
42+
entry: ['@babel/polyfill',
43+
+ 'whatwg-fetch',
44+
'./main.tsx'
45+
],
46+
```
47+
3748
- Let's replace _memberAPI_ load members with the fetch / promise one:
3849

3950
_./src/api/memberAPI.ts_
4051

4152
```javascript
4253
import { MemberEntity } from '../model/member';
43-
import {} from 'whatwg-fetch';
4454

4555
// Sync mock data API, inspired from:
4656
// https://gist.github.com/coryhouse/fd6232f95f9d601158e4

12_TableHttp/src/api/memberAPI.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {MemberEntity} from '../model/member';
2-
import {fetch} from 'whatwg-fetch';
32

43
// Sync mock data API, inspired from:
54
// https://gist.github.com/coryhouse/fd6232f95f9d601158e4

12_TableHttp/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
extensions: ['.js', '.ts', '.tsx']
1212
},
1313
entry: ['@babel/polyfill',
14+
'whatwg-fetch',
1415
'./main.tsx'
1516
],
1617
output: {

0 commit comments

Comments
 (0)