File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { NetworkType } from '../model/network/NetworkType';
21
21
import { Page } from './Page' ;
22
22
import { QueryParams } from './QueryParams' ;
23
23
import { RepositoryCallError } from './RepositoryCallError' ;
24
+ import fetch from 'node-fetch' ;
24
25
25
26
/**
26
27
* Http extended by all http services
@@ -99,7 +100,8 @@ export abstract class Http {
99
100
}
100
101
101
102
public config ( ) : Configuration {
102
- return new Configuration ( { basePath : this . url , fetchApi : this . fetchApi , queryParamsStringify : querystring } ) ;
103
+ const fetchApi = this . fetchApi || ( typeof window !== 'undefined' && window . fetch . bind ( window ) ) || fetch ;
104
+ return new Configuration ( { basePath : this . url , fetchApi : fetchApi , queryParamsStringify : querystring } ) ;
103
105
}
104
106
105
107
/**
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ import { TransactionHttp } from './TransactionHttp';
49
49
import { TransactionRepository } from './TransactionRepository' ;
50
50
import { TransactionStatusHttp } from './TransactionStatusHttp' ;
51
51
import { TransactionStatusRepository } from './TransactionStatusRepository' ;
52
- import fetch from 'node-fetch' ;
53
52
/**
54
53
* Receipt http repository.
55
54
*
@@ -69,7 +68,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory {
69
68
*/
70
69
constructor ( url : string , configs ?: RepositoryFactoryConfig ) {
71
70
this . url = url ;
72
- this . fetchApi = configs ?. fetchApi || ( typeof window !== 'undefined' && window . fetch . bind ( window ) ) || fetch ;
71
+ this . fetchApi = configs ?. fetchApi ;
73
72
this . networkType = configs ?. networkType
74
73
? observableOf ( configs . networkType )
75
74
: this . createNetworkRepository ( ) . getNetworkType ( ) . pipe ( shareReplay ( 1 ) ) ;
You can’t perform that action at this time.
0 commit comments