Skip to content

Commit

Permalink
fix(wc): remove gn4API service call during service initialization
Browse files Browse the repository at this point in the history
For web components, the API_URL is not defined yet during Angular Service initialization.
Use cold Observable instead to avoid calling an API while not subscribed yet
  • Loading branch information
fgravin committed Sep 8, 2023
1 parent 417941f commit 748f03e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ interface IncompleteOrganization {
export class OrganizationsFromMetadataService
implements OrganizationsServiceInterface
{
geonetworkVersion$ = this.siteApiService.getSiteOrPortalDescription().pipe(
geonetworkVersion$ = of(true).pipe(
switchMap(() => this.siteApiService.getSiteOrPortalDescription()),
map((info) => info['system/platform/version']),
shareReplay(1)
)

private groups$: Observable<GroupApiModel[]> = this.groupsApiService
.getGroups()
.pipe(shareReplay())
private groups$: Observable<GroupApiModel[]> = of(true).pipe(
switchMap(() => this.groupsApiService.getGroups()),
shareReplay()
)
private organisationsAggs$: Observable<OrganizationAggsBucket[]> =
this.geonetworkVersion$.pipe(
switchMap((version) =>
Expand Down

0 comments on commit 748f03e

Please sign in to comment.