mirror of
https://github.com/bitwarden/browser
synced 2025-12-26 21:23:34 +00:00
node fetch api
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user