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:
parent
ec936f883f
commit
806bd8d039
|
@ -631,7 +631,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
|||
{
|
||||
provide: ConfigApiServiceAbstraction,
|
||||
useClass: ConfigApiService,
|
||||
deps: [ApiServiceAbstraction],
|
||||
deps: [ApiServiceAbstraction, AuthServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: AnonymousHubServiceAbstraction,
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
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";
|
||||
|
||||
export class ConfigApiService implements ConfigApiServiceAbstraction {
|
||||
constructor(private apiService: ApiService) {}
|
||||
constructor(private apiService: ApiService, private authService: AuthService) {}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue