TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

前端 未结 20 1133
时光说笑
时光说笑 2020-12-01 06:22

I am trying to map from a service call but getting an error. Looked at subscribe is not defined in angular 2? and it said that in order to subscribe we need to

20条回答
  •  旧巷少年郎
    2020-12-01 06:25

    this error happened with me when i am using interceptor you have to do this in your interceptor

    return next.handle(request).map(event => {
            if (event instanceof HttpResponse) {
    
            }
            return event;
        },
          catchError((error: HttpErrorResponse) => {
            if (error.status === 401 || error.status === 400) {
              // some logic
    
            }
    

提交回复
热议问题