diff --git a/projects/ucap-webmessenger-pi/src/lib/services/pi.service.ts b/projects/ucap-webmessenger-pi/src/lib/services/pi.service.ts index a7b1e274..34161cf5 100644 --- a/projects/ucap-webmessenger-pi/src/lib/services/pi.service.ts +++ b/projects/ucap-webmessenger-pi/src/lib/services/pi.service.ts @@ -1,8 +1,8 @@ import { Injectable, Inject } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpRequest, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, filter } from 'rxjs/operators'; import { Login2Request, @@ -45,15 +45,22 @@ export class PiService { } public login2(req: Login2Request): Observable { - return this.httpClient - .post( - this.urls.login2, - {}, - { - params: encodeLogin2(req) + const httpReq = new HttpRequest( + 'POST', + this.urls.login2, + encodeLogin2(req), + { reportProgress: true } + ); + + return this.httpClient.request(httpReq).pipe( + filter(event => { + if (event instanceof HttpResponse) { + return true; } - ) - .pipe(map(res => decodeLogin2(res))); + return false; + }), + map(res => decodeLogin2((res as HttpResponse).body)) + ); } public userTermsAction(