File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,23 @@ Install [Node.js and npm](https://nodejs.org/en/) (v6.6.0 or newer) if they are
3434npm 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
4253import { MemberEntity } from ' ../model/member' ;
43- import {} from ' whatwg-fetch' ;
4454
4555// Sync mock data API, inspired from:
4656// https://gist.github.com/coryhouse/fd6232f95f9d601158e4
Original file line number Diff line number Diff line change 11import { 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
Original file line number Diff line number Diff 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 : {
You can’t perform that action at this time.
0 commit comments