Quote from RxJS dev team:
To fix all these issues, we decided to deprecate
toPromise(), and to introduce the two new helper functions for conversion to Promises.Use one of the two new functions
As a replacement to the deprecated
toPromise()method, you should use one of the two built in static conversion functionsfirstValueFromorlastValueFrom....
In my case I send a get request to the server to check if the server is available or not. The main function (in this case the ngOnInit()) will not go further until an HTTP response or an error comes back.
At this part of the article, they suggest adding a timeout to the lastValueFrom() function, which should be added as a config config?: LastValueFromConfig<D>.
My code:
let something = lastValueFrom(this.http.get<resultDTO>
('/api/account/test'),).then(
res => {
this.note = (res.data);
}
);
How do I have to set this config and pass it to the function?