mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
AAE-35340 Replace deprecated toPromise() usages with firstValueFrom / lastValueFrom (#11161)
This commit is contained in:
@@ -19,7 +19,7 @@ import { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';
|
||||
import { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient } from '@alfresco/js-api';
|
||||
import { HttpClient, HttpContext, HttpErrorResponse, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, of, Subject, throwError } from 'rxjs';
|
||||
import { lastValueFrom, Observable, of, Subject, throwError } from 'rxjs';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
import {
|
||||
convertObjectToFormData,
|
||||
@@ -196,8 +196,8 @@ export class AdfHttpClient implements JsApiHttpClient {
|
||||
const abort$ = new Subject<void>();
|
||||
const { eventEmitter, apiClientEmitter } = emitters;
|
||||
|
||||
const promise = request$
|
||||
.pipe(
|
||||
const promise = lastValueFrom(
|
||||
request$.pipe(
|
||||
map((res) => {
|
||||
if (isHttpUploadProgressEvent(res)) {
|
||||
const percent = Math.round((res.loaded / res.total) * 100);
|
||||
@@ -243,7 +243,7 @@ export class AdfHttpClient implements JsApiHttpClient {
|
||||
}),
|
||||
takeUntil(abort$)
|
||||
)
|
||||
.toPromise();
|
||||
);
|
||||
|
||||
(promise as any).abort = function () {
|
||||
eventEmitter.emit('abort');
|
||||
|
Reference in New Issue
Block a user