File tree 4 files changed +19
-6
lines changed
4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 21
21
"devDependencies" : {
22
22
"@ef-carbon/fetch" : " ^2.1.3" ,
23
23
"@types/node" : " ^10.12.18" ,
24
+ "@types/node-fetch" : " ^2.1.4" ,
24
25
"ava" : " ^1.0.1" ,
25
26
"cross-env" : " ^5.2.0" ,
26
27
"node-fetch" : " ^2.3.0" ,
Original file line number Diff line number Diff line change
1
+ import FetchOptions from './lib/FetchOptions' ;
2
+
3
+ const callFetch = ( url : string , options : Partial < FetchOptions > ) => {
4
+ //@ts -ignore
5
+ if ( typeof fetch === 'undefined' ) {
6
+ return import ( 'node-fetch' ) . then ( fetch => {
7
+ //@ts -ignore
8
+ return fetch ( url , options ) ;
9
+ } ) ;
10
+ }
11
+
12
+ //@ts -ignore
13
+ return fetch ( url , options ) ;
14
+ } ;
15
+
16
+ export default callFetch ;
Original file line number Diff line number Diff line change 1
1
import FetchOptions from './FetchOptions' ;
2
- import { skip , isNode } from '../Utils' ;
2
+ import { skip } from '../Utils' ;
3
3
import Fetch from '.' ;
4
4
import { QueryObject } from '../types' ;
5
-
6
- if ( typeof fetch == 'undefined' ) {
7
- var fetch = require ( 'node-fetch' ) ;
8
- }
5
+ import fetch from '../fetch' ;
9
6
10
7
export default class FetchRequest {
11
8
options : FetchOptions = new FetchOptions ( ) ;
Original file line number Diff line number Diff line change 9
9
"module" : " CommonJS" ,
10
10
},
11
11
"exclude" : [
12
- " node_modules" ,
13
12
" exampleApp"
14
13
]
15
14
}
You can’t perform that action at this time.
0 commit comments