Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate HTTP_INTERCEPTORS of Angular as FullRequestInterceptors #182

Open
patrickbussmann opened this issue Nov 23, 2019 · 0 comments
Open

Comments

@patrickbussmann
Copy link

If you have HTTP Interceptors from Angular, https://angular.io/api/common/http/HttpInterceptor, then this will be ignored from this ngx-restangular.
So it would be nice if someone could integrate this.

src/app/app.module.ts
export function RestangularConfigFactory(RestangularProvider) {
  RestangularProvider.setBaseUrl(environment.url);
  RestangularProvider.addFullRequestInterceptor(AuthInterceptor); // <- Not working!
}

@NgModule({
  imports: [
    RestangularModule.forRoot(RestangularConfigFactory),
    HttpClientModule,
  ],
  providers: [
    { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Thanks in Advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant