Replace toPromise with async firstValueFrom

`Observable.toPromise()` is deprecated in RxJS 7 and removed in 8;
`firstValueFrom` is the supported replacement for awaiting a single
HTTP emission. Rewrites the loader as `async` to drop the `.then`
closure.
This commit is contained in:
Alexander Brandon Coles
2026-06-13 16:24:15 +01:00
parent 54045650e3
commit 7497569914
@@ -27,6 +27,7 @@
//++
import { Injectable, inject } from '@angular/core';
import { firstValueFrom } from 'rxjs';
import moment from 'moment';
import { ConfigurationResource } from 'core-app/features/hal/resources/configuration-resource';
@@ -158,14 +159,7 @@ export class ConfigurationService {
return this.configuration.triallingFeatures;
}
private loadConfiguration() {
return this
.apiV3Service
.configuration
.get()
.toPromise()
.then((configuration:ConfigurationResource) => {
this.configuration = configuration;
});
private async loadConfiguration():Promise<void> {
this.configuration = await firstValueFrom(this.apiV3Service.configuration.get());
}
}