Skip to content

Commit

Permalink
NAS-131213: Fix remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
bvasilenko committed Nov 1, 2024
1 parent 466b025 commit e6d4c7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/services/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
switchMap,
take,
tap,
throwError,
timer,
} from 'rxjs';
import { AccountAttribute } from 'app/enums/account-attribute.enum';
Expand Down Expand Up @@ -258,12 +259,13 @@ export class AuthService {
private getFilteredWebSocketResponse<T>(uuid: string): Observable<T> {
return this.wsManager.websocket$.pipe(
filter((data: IncomingWebSocketMessage) => data.msg === IncomingApiMessageType.Result && data.id === uuid),
map((data: ResultMessage<T>) => {
if (data.error) {
throw data.error as unknown;
switchMap((data: IncomingWebSocketMessage) => {
if ('error' in data && data.error) {
return throwError(() => data.error);
}
return data.result;
return of(data);
}),
map((data: ResultMessage<T>) => data.result),
take(1),
);
}
Expand Down

0 comments on commit e6d4c7e

Please sign in to comment.