polyfill fetch globals on nodeapi
This commit is contained in:
parent
17cf059970
commit
f173001a41
|
@ -108,6 +108,15 @@
|
|||
"integrity": "sha512-VRQB+Q0L3YZWs45uRdpN9oWr82meL/8TrJ6faoKT5tp0uub2l/aRMhtm5fo68h7kjYKH60f9/bay1nF7ZpTW5g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "1.6.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-1.6.9.tgz",
|
||||
"integrity": "sha512-n2r6WLoY7+uuPT7pnEtKJCmPUGyJ+cbyBR8Avnu4+m1nzz7DwBVuyIvvlBzCZ/nrpC7rIgb3D6pNavL7rFEa9g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "8.0.19"
|
||||
}
|
||||
},
|
||||
"@types/node-forge": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-0.7.1.tgz",
|
||||
|
|
|
@ -28,15 +28,16 @@
|
|||
"@types/keytar": "^4.0.1",
|
||||
"@types/lunr": "2.1.5",
|
||||
"@types/node": "8.0.19",
|
||||
"@types/node-fetch": "^1.6.9",
|
||||
"@types/node-forge": "0.7.1",
|
||||
"@types/papaparse": "4.1.31",
|
||||
"@types/webcrypto": "0.0.28",
|
||||
"concurrently": "3.5.1",
|
||||
"electron": "1.8.4",
|
||||
"jasmine": "^3.1.0",
|
||||
"jasmine-ts-console-reporter": "^3.1.1",
|
||||
"jasmine-core": "^2.8.0",
|
||||
"jasmine-spec-reporter": "^4.2.1",
|
||||
"jasmine-ts-console-reporter": "^3.1.1",
|
||||
"karma": "^1.7.1",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import { Utils } from '../misc/utils';
|
||||
import * as fe from 'node-fetch';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
|
||||
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
||||
import { TokenService } from '../abstractions/token.service';
|
||||
|
||||
import * as fetch from 'node-fetch';
|
||||
(global as any).fetch = fe.default;
|
||||
(global as any).Request = fe.Request;
|
||||
(global as any).Response = fe.Response;
|
||||
(global as any).Headers = fe.Headers;
|
||||
|
||||
export class NodeApiService extends ApiService {
|
||||
constructor(tokenService: TokenService, platformUtilsService: PlatformUtilsService,
|
||||
|
|
Loading…
Reference in New Issue