Tech-Debt - [PM-2283] - Update ConfigApiService getServerConfig call to send access token if it exists (#5464)

* PM-2283 - Update config api service get server config call to send authed when we have an access token so that LaunchDarkly on the server can properly acquire user context.

* PM-2283- Replace token service with Auth service per PR feedback

* PM-2283 - Refactor config api service get authed status based on PR feedback.

* PM-2283 - Fix import issues due to platform folder creation and file moves
This commit is contained in:
Jared Snider 2023-06-07 17:47:30 -04:00 committed by GitHub
parent ec936f883f
commit 806bd8d039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -631,7 +631,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
{ {
provide: ConfigApiServiceAbstraction, provide: ConfigApiServiceAbstraction,
useClass: ConfigApiService, useClass: ConfigApiService,
deps: [ApiServiceAbstraction], deps: [ApiServiceAbstraction, AuthServiceAbstraction],
}, },
{ {
provide: AnonymousHubServiceAbstraction, provide: AnonymousHubServiceAbstraction,

View File

@ -1,12 +1,17 @@
import { ApiService } from "../../../abstractions/api.service"; import { ApiService } from "../../../abstractions/api.service";
import { ConfigApiServiceAbstraction as ConfigApiServiceAbstraction } from "../../abstractions/config/config-api.service.abstraction"; import { AuthService } from "../../../auth/abstractions/auth.service";
import { AuthenticationStatus } from "../../../auth/enums/authentication-status";
import { ConfigApiServiceAbstraction } from "../../abstractions/config/config-api.service.abstraction";
import { ServerConfigResponse } from "../../models/response/server-config.response"; import { ServerConfigResponse } from "../../models/response/server-config.response";
export class ConfigApiService implements ConfigApiServiceAbstraction { export class ConfigApiService implements ConfigApiServiceAbstraction {
constructor(private apiService: ApiService) {} constructor(private apiService: ApiService, private authService: AuthService) {}
async get(): Promise<ServerConfigResponse> { async get(): Promise<ServerConfigResponse> {
const r = await this.apiService.send("GET", "/config", null, false, true); const authed: boolean =
(await this.authService.getAuthStatus()) !== AuthenticationStatus.LoggedOut;
const r = await this.apiService.send("GET", "/config", null, authed, true);
return new ServerConfigResponse(r); return new ServerConfigResponse(r);
} }
} }