Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
polyfill fetch globals on nodeapi
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed May 15, 2018
1 parent 17cf059 commit f173001
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/services/nodeApi.service.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit f173001

Please sign in to comment.