mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
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:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user