Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-08-12 16:24:50 +03:00
parent 96c955b412
commit ad798713df
59 changed files with 15882 additions and 1887 deletions

View File

@@ -0,0 +1,46 @@
/* tslint:disable */
/* eslint-disable */
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ApiConfiguration, ApiConfigurationParams } from './api-configuration';
import { PkgdashServiceService } from './services/pkgdash-service.service';
/**
* Module that provides all services and configuration.
*/
@NgModule({
imports: [],
exports: [],
declarations: [],
providers: [
PkgdashServiceService,
ApiConfiguration
],
})
export class ApiModule {
static forRoot(params: ApiConfigurationParams): ModuleWithProviders<ApiModule> {
return {
ngModule: ApiModule,
providers: [
{
provide: ApiConfiguration,
useValue: params
}
]
}
}
constructor(
@Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient
) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}