Angular : how to call finally() with RXJS 6

Sunil Kumar :

I was using RXJS 5, now as I upgraded it to 6, I am facing some problems.

Previously I was able to use catch and finally but as per update catch is replaced with catchError (with in the pipe) now how to use finally?

Also I have some questions :

Do I need to change throw->throwError (in below code Observable.throw(err);)

import { Observable, Subject, EMPTY, throwError } from "rxjs";
import { catchError } from 'rxjs/operators';

return next.handle(clonedreq).pipe(
          catchError((err: HttpErrorResponse) => {
        if ((err.status == 400) || (err.status == 401)) {
            this.interceptorRedirectService.getInterceptedSource().next(err.status);
            return Observable.empty();
        } else {
            return Observable.throw(err);
        }
       }) 
        //, finally(() => {
        //  this.globalEventsManager.showLoader.emit(false);
        //});
      );

Also how to use publish().refCount() now ?

martin :

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Angular 6 RXJS Import Syntax?

Angular 6 / Rxjs - how to basics: observables success, error, finally

Angular/RxJS 6: How to prevent duplicate HTTP requests?

How to import rxjs timer in angular 6?

How do you sort an Observable<Item[]> in Angular 6 with rxjs 6?

How can I process results from http.get() in Angular 6/RxJS 6?

How do I return the Resolved Data with the new RXJS 6 pipe/map in Angular 6?

How to target an HTML element using rxjs fromEvent in Angular 6

Angular 6 & RxJS 6 Breaking Changes

How to keep observable alive after error in RxJS 6 and Angular 6

Angular 6 - how to await the subscribe on a call

Convert Rxjs code to Angular 6 and latest rxjs

How to return value from subscribe of forkJoin with angular 6 and RxJs 6?

Angular 6 how to pipe http call

Angular 2 and RxJS: How to change HTTP call that returns Observable

How to call multiple API and subscribe in angular 6?

How to make a sequence of http requests in Angular 6 using RxJS

Angular 6 How to get status of method call from Component to Service?

Angular 6 not call ngClass

Angular 7 (RxJs 6.x) - How to use throwError

rxjs 6 countdown timer subscribe angular 6

How to implement Scroll animation in Angular 8 with rxjs 6?

How to flatten the nested calls in RXJS and finally invoke one last call?

How to call Http post and get request in angular 6

rxjs 6 pipe is not working in Angular 6

How to verify ngCopy method call in angular 6 unit test

How can I call a REST API early and often using RxJS and Angular 8?

Angular rxjs conditionally call HTTP endpoint

How to call the API in sequential order in Angular9 with rxjs?

TOP Ranking

  1. 1

    What exactly is memory mapped io and port based io

  2. 2

    How i extract text from a model dialog in selenium?

  3. 3

    pump.io port in URL

  4. 4

    Selenium browsing with headless isn't working?

  5. 5

    change TabView indicator SwiftUI

  6. 6

    python requests How to send data to a website

  7. 7

    Kubernetes pods not starting, running behind a proxy

  8. 8

    Scaffold-DbContext returns System.ArgumentNullException: Parameter name: proposedIdentifier in EFCore 2.0 when trying to pluralize

  9. 9

    Java POI: How to find an Excel cell with a string value and get its position (row) to use that position to find another cell

  10. 10

    Creating interaction sessions based on timestamps in pandas

  11. 11

    Maven annotation processing processor not found

  12. 12

    Missing field when deserializing using Jackson (Polymorphic)

  13. 13

    Spring Data JPA repository methods don't recognize property names with underscores

  14. 14

    Get all Woocommerce products from current product category term Id in a WP_Query

  15. 15

    How to update if key exists - sequelize

  16. 16

    I got message for error_log file "The stream or file ".../laravel.log" could not be opened: failed to open stream: Permission denied"

  17. 17

    Servlet: HTTP Status 404 - Not Found

  18. 18

    Type 'Moment' is not assignable to type 'Date'. Property 'toDateString' is missing in type 'Moment'

  19. 19

    what is key in CTTelephonyNetworkInfo().serviceSubscriberCellularProviders and CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology

  20. 20

    Laravel(ajax) 404 not found

  21. 21

    Error: Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters

HotTag

Archive