mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
node fetch api
This commit is contained in:
parent
5850a590ce
commit
17cf059970
5
package-lock.json
generated
5
package-lock.json
generated
@ -5786,6 +5786,11 @@
|
||||
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=",
|
||||
"dev": true
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz",
|
||||
"integrity": "sha1-q4hOjn5X44qUR1POxwb3iNF2i7U="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz",
|
||||
|
@ -73,6 +73,7 @@
|
||||
"electron-updater": "2.21.4",
|
||||
"keytar": "4.1.0",
|
||||
"lunr": "2.1.6",
|
||||
"node-fetch": "2.1.2",
|
||||
"node-forge": "0.7.1",
|
||||
"rxjs": "5.5.6",
|
||||
"zone.js": "0.8.19"
|
||||
|
@ -439,12 +439,10 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
}
|
||||
|
||||
private async handleTokenState(): Promise<string> {
|
||||
let accessToken: string;
|
||||
let accessToken = await this.tokenService.getToken();
|
||||
if (this.tokenService.tokenNeedsRefresh()) {
|
||||
const tokenResponse = await this.doRefreshToken();
|
||||
accessToken = tokenResponse.accessToken;
|
||||
} else {
|
||||
accessToken = await this.tokenService.getToken();
|
||||
}
|
||||
|
||||
return 'Bearer ' + accessToken;
|
||||
|
15
src/services/nodeApi.service.ts
Normal file
15
src/services/nodeApi.service.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Utils } from '../misc/utils';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
|
||||
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
||||
import { TokenService } from '../abstractions/token.service';
|
||||
|
||||
import * as fetch from 'node-fetch';
|
||||
|
||||
export class NodeApiService extends ApiService {
|
||||
constructor(tokenService: TokenService, platformUtilsService: PlatformUtilsService,
|
||||
logoutCallback: Function) {
|
||||
super(tokenService, platformUtilsService, logoutCallback);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user