1
|
import { ToastModule } from 'primeng/toast';
|
2
|
import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
|
3
|
import { environment } from './../environments/environment';
|
4
|
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
5
|
import { BrowserModule } from '@angular/platform-browser';
|
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
7
|
import { NgModule } from '@angular/core';
|
8
|
|
9
|
import { AppRoutingModule } from './app-routing.module';
|
10
|
import { AppComponent } from './app.component';
|
11
|
import { CoreModule } from './core/core.module';
|
12
|
import { FeaturesModule } from './features/features.module';
|
13
|
import { SharedModule } from './shared/shared.module';
|
14
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
15
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
16
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
17
|
import { SearchListStateService } from './shared/back-button/search-list-state.service';
|
18
|
|
19
|
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
20
|
return new TranslateHttpLoader(http);
|
21
|
}
|
22
|
|
23
|
// Settings localStorage as OAuth2 storage.
|
24
|
// We need a factory, since localStorage is not available during AOT build time.
|
25
|
export function storageFactory(): OAuthStorage {
|
26
|
return localStorage;
|
27
|
}
|
28
|
|
29
|
|
30
|
@NgModule({
|
31
|
declarations: [
|
32
|
AppComponent
|
33
|
],
|
34
|
imports: [
|
35
|
BrowserModule,
|
36
|
BrowserAnimationsModule,
|
37
|
AppRoutingModule,
|
38
|
CoreModule,
|
39
|
FeaturesModule,
|
40
|
SharedModule,
|
41
|
HttpClientModule,
|
42
|
ToastModule,
|
43
|
OAuthModule.forRoot({
|
44
|
resourceServer: {
|
45
|
allowedUrls: [environment.baseApiUrl],
|
46
|
sendAccessToken: true
|
47
|
}
|
48
|
}),
|
49
|
TranslateModule.forRoot({
|
50
|
loader: {
|
51
|
provide: TranslateLoader,
|
52
|
useFactory: HttpLoaderFactory,
|
53
|
deps: [HttpClient]
|
54
|
},
|
55
|
defaultLanguage: environment.defaultLanguage,
|
56
|
}),
|
57
|
],
|
58
|
providers: [ConfirmationService, { provide: OAuthStorage, useFactory: storageFactory }, MessageService, SearchListStateService],
|
59
|
bootstrap: [AppComponent]
|
60
|
})
|
61
|
export class AppModule { }
|