Closed maxime1992 closed 7 years ago
Could be that this.http
is being injected as the vanilla Http
service? What's your constructor signature on the controller?
To inject the Interceptor service, it should be like:
contructor(private http:InterceptorService){
}
public connectUser(user: IUser) [....]
Also, it's not related to this issue, but remember that you also need to delcare the provider for your HttpResponseInterceptor
service, so if you haven't, in your app module you should put something like:
providers: [
HttpResponseInterceptor,
provideInterceptorService([
HttpResponseInterceptor
])
]
Oh I must be tired ... I did inject Http instead of InterceptorService. It works perfectly ! Thanks. And I forgot to add the providers because I created a class first and then I turned this class into a service :).
Thanks for helping me, cheers ! :+1:
Hi, I really like the idea of interceptors.
I need that in an app to catch 401 and redirect to /login.
Here's what I did so far :
HttpResponseInterceptor
service :When I make an http request :
I do not have request start or request ended displayed.
What am I missing ?
Thanks