RxJS
unknown
typescript
2 years ago
1.1 kB
4
Indexable
/* DLACZEGO PONIŻY KOD BEZ PRZERWY WYSYŁA REQUESTY */ this.messagesService.getChosenMessagesList().subscribe( messages => { this.messagesService.changeStateOfMessage(messages, MStatusType.Deleted).subscribe(); }); /* poniżej kod do którego powyższy kod się odwołuje */ /** Zwraca wybrane wiadomości z select */ getChosenMessagesList() { return this.chosenMessagesList.asObservable(); } /** Funkcja wykorzystywana do zmiany statusu wiadomości */ changeStateOfMessage(ids: number[], status: MStatusType): Observable<boolean> { const params = { ids: ids, status: status, }; return this.apiService.Post<IBaseApiResponse<boolean>>(API_URL__MESSAGES.CHANGE_MESSAGES_STATUS__POST, params).pipe( tap(resp => this.setRefreshValue(resp?.Data)), map(resp => resp?.Data), catchError(() => of(false))); } /** Ustawianie flagi odpowiedzialnej za odświeżenie */ setRefreshValue(refreshState: boolean) { this.refresh.next(refreshState); }
Editor is loading...
Leave a Comment