iT邦幫忙

1

Angular HttpInterceptor 攔截不到呼叫 firebase cloud functions的request

小弟想請教一個問題,我用Angular呼叫 AngularFireFunctions httpsCallable拿到的functions api,我想用angular HttpInterceptor控制loading畫面的切換,想請問我的request打不到Interceptor裡面,沒有console出結果,想請問是哪個部分出問題?我也有在providers添加這個service

p.s 我有用HttpClient get去測試,是可以進到Interceptor,console得出結果!

@Injectable()
export class AjaxInterceptorService implements HttpInterceptor {

  constructor(private _common: CommonService) { }

  intercept(
    req: HttpRequest<any>, next: HttpHandler
  ): Observable<HttpEvent<any>> {
    console.log(req);
    return next.handle(req);
  }

}
providers: [{
    provide: HTTP_INTERCEPTORS,
    useClass: AjaxInterceptorService,
    multi: true
  }]

尚未有邦友回答

立即登入回答