1 |
f8b9a3a2
|
hlavja
|
/* tslint:disable */
|
2 |
|
|
/* eslint-disable */
|
3 |
|
|
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
4 |
|
|
import { HttpClient } from '@angular/common/http';
|
5 |
|
|
import { ApiConfiguration, ApiConfigurationParams } from './api-configuration';
|
6 |
|
|
|
7 |
|
|
import { LoginService } from './services/login.service';
|
8 |
b6006ff4
|
hlavja
|
import { AdministrationService } from './services/administration.service';
|
9 |
cd2a65f3
|
hlavja
|
import { SensorsService } from './services/sensors.service';
|
10 |
11efc186
|
hlavja
|
import { ObservationService } from './services/observation.service';
|
11 |
f8b9a3a2
|
hlavja
|
import { GroupService } from './services/group.service';
|
12 |
1d6ec56f
|
hlavja
|
import { DataService } from './services/data.service';
|
13 |
a7285540
|
hlavja
|
import { AnalyticsService } from './services/analytics.service';
|
14 |
a3ae1cab
|
hlavja
|
import { ManagementService } from './services/management.service';
|
15 |
f8b9a3a2
|
hlavja
|
|
16 |
|
|
/**
|
17 |
|
|
* Module that provides all services and configuration.
|
18 |
|
|
*/
|
19 |
|
|
@NgModule({
|
20 |
|
|
imports: [],
|
21 |
|
|
exports: [],
|
22 |
|
|
declarations: [],
|
23 |
|
|
providers: [
|
24 |
|
|
LoginService,
|
25 |
b6006ff4
|
hlavja
|
AdministrationService,
|
26 |
cd2a65f3
|
hlavja
|
SensorsService,
|
27 |
11efc186
|
hlavja
|
ObservationService,
|
28 |
f8b9a3a2
|
hlavja
|
GroupService,
|
29 |
1d6ec56f
|
hlavja
|
DataService,
|
30 |
a7285540
|
hlavja
|
AnalyticsService,
|
31 |
a3ae1cab
|
hlavja
|
ManagementService,
|
32 |
f8b9a3a2
|
hlavja
|
ApiConfiguration
|
33 |
|
|
],
|
34 |
|
|
})
|
35 |
|
|
export class ApiModule {
|
36 |
|
|
static forRoot(params: ApiConfigurationParams): ModuleWithProviders<ApiModule> {
|
37 |
|
|
return {
|
38 |
|
|
ngModule: ApiModule,
|
39 |
|
|
providers: [
|
40 |
|
|
{
|
41 |
|
|
provide: ApiConfiguration,
|
42 |
|
|
useValue: params
|
43 |
|
|
}
|
44 |
|
|
]
|
45 |
|
|
}
|
46 |
|
|
}
|
47 |
|
|
|
48 |
ea0e5344
|
hlavja
|
constructor(
|
49 |
f8b9a3a2
|
hlavja
|
@Optional() @SkipSelf() parentModule: ApiModule,
|
50 |
|
|
@Optional() http: HttpClient
|
51 |
|
|
) {
|
52 |
|
|
if (parentModule) {
|
53 |
|
|
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
54 |
|
|
}
|
55 |
|
|
if (!http) {
|
56 |
|
|
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
57 |
|
|
'See also https://github.com/angular/angular/issues/20575');
|
58 |
|
|
}
|
59 |
|
|
}
|
60 |
|
|
}
|