0.0.1 • Published 5 years ago

@xyzblocks/ng-http-interceptors v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@xyzblocks/ng-http-interceptors

Angular HTTP Interceptors

Build Status

Installation

npm install --save @xyzblocks/ng-http-interceptors

API

CachingHttpInterceptor

@NgModule({
  declarations: [AppComponent],
  imports: [],
  providers: [
    {
      provide: HTTP_INTERCEPTORS,
      useValue: new CachingHttpInterceptor(
        {
          delete: [/.*/],
          get: [/.*/],
          patch: [/.*/],
          post: [/.*/],
          put: [/.*/]
        },
        null, // getCacheItem(key: string) => Observable<any>; Uses localStorage by default
        null, // setCacheItem(key: string, obj: any) => Observable<void>; Uses localStorage by default
      ),
      multi: true,
    },
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}