Cz-Angular
This project was generated with Angular CLI version 8.1.0.
Components
<cz-empty-page [src]="" [width]="100%" [height]="100%">
<cz-error-page [src]="" [width]="100%" [height]="100%">
Services
AuthService LocalStorageService CookieService
Interceptors
Http Interceptors Logging Interceptors
Imports
import { EmptyPageComponent, ErrorPageComponent, SpinnerComponent } from 'cz-angular';
import { HttpInterceptor, LoggingInterceptor, HttpRequestManager } from 'cz-angular';
import { AuthService, CookiesService, LocalStorageService } from 'cz-angular';
##Http Interceptor
Http Interceptor accept custom header config object like this
config {
'Authorization': string,
'Content-Type' : string,
'Accept' : string
}
by default it acccept Authorization token from Cookie Service getCookie('token') method.
first you have set token in cookie by using setCookieData('token','token') method.
Content-Type is Applicatin/json and Accept type is application/json and you can override this config by passing your config object in Authservice setheaderConfig method.
##HttpRequestManager
Use HttpRequestManager for any http request
get(url,httpOptions?)
post(url, body, httpOptions?)
put(url, body, httpOptions?)
delete(url , httpOptions?)
##HttpOptions Structure
Import HttpHeader
httpOptions = {
headers: new HttpHeaders({ 'Content-Type':'application/json', 'Accept': 'application/json' })
}
##Note To use HttpRequestManager import httpclientModule in app.module.ts and also include in NgModule.