Untitled
unknown
javascript
2 years ago
994 B
5
Indexable
/** 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);
}
/* DLACZEGO PONIŻY KOD BEZ PRZERWY WYSYŁA REQUESTY */
this.messagesService.getChosenMessagesList().subscribe(messages => {
this.messagesService.changeStateOfMessage(messages, MStatusType.Deleted).subscribe();
});Editor is loading...
Leave a Comment