Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ngx-customapp-proto-http

Install

yarn add ngx-customapp-proto-http

Install and configure ngx-customapp-errors and ngx-customapp-jwt packages, cos them are used by this package.

Create the config ProtoHttpConfig.

Import ProtoHttpModule.forRoot(config) in your app.module.

Use RequestService to make requests.

@Injectable()
export class MenuService {

constructor(
private request: RequestService<Request.AsObject, Response.AsObject>,
) {}

getCategoryList(): Observable<CategoryListResponse.AsObject> {
return this.request.request(
baseUrl + '/category/list',
{categories: {}} // instance of the Request.AsObject
).pipe(map(resp => resp.categories!))
}
}

Add VersionInterceptor to the app.module providers, if you wish.

@NgModule({
// ... imports, declarations, bootstrap
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: VersionInterceptor,
multi: true,
}
]
})
export class AppModule {
}

Index

Variables

PROTO_HTTP_CONFIG: InjectionToken<ProtoHttpConfig<any, any>> = ...
disableVersionInterception: HttpContextToken<boolean> = ...

Used to disable setting version header.

protobufHeader: { name: string; value: string } = ...

Type declaration

  • name: string
  • value: string

Generated using TypeDoc