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';
2121import { Page } from './Page' ;
2222import { QueryParams } from './QueryParams' ;
2323import { RepositoryCallError } from './RepositoryCallError' ;
24+ import fetch from 'node-fetch' ;
2425
2526/**
2627 * Http extended by all http services
@@ -99,7 +100,8 @@ export abstract class Http {
99100 }
100101
101102 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 } ) ;
103105 }
104106
105107 /**
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ import { TransactionHttp } from './TransactionHttp';
4949import { TransactionRepository } from './TransactionRepository' ;
5050import { TransactionStatusHttp } from './TransactionStatusHttp' ;
5151import { TransactionStatusRepository } from './TransactionStatusRepository' ;
52- import fetch from 'node-fetch' ;
5352/**
5453 * Receipt http repository.
5554 *
@@ -69,7 +68,7 @@ export class RepositoryFactoryHttp implements RepositoryFactory {
6968 */
7069 constructor ( url : string , configs ?: RepositoryFactoryConfig ) {
7170 this . url = url ;
72- this . fetchApi = configs ?. fetchApi || ( typeof window !== 'undefined' && window . fetch . bind ( window ) ) || fetch ;
71+ this . fetchApi = configs ?. fetchApi ;
7372 this . networkType = configs ?. networkType
7473 ? observableOf ( configs . networkType )
7574 : this . createNetworkRepository ( ) . getNetworkType ( ) . pipe ( shareReplay ( 1 ) ) ;
You can’t perform that action at this time.
0 commit comments