You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/09/16 12:52:40 UTC

[incubator-dlab] 04/05: moved interseptors loading to core module

This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch dlab-loading
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 26c4c23339f8b3c090c2523de5c0a6f321e0cb99
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Mon Sep 16 15:33:54 2019 +0300

    moved interseptors loading to core module
---
 .../main/resources/webapp/src/app/app.module.ts    | 26 +++++-----------------
 .../resources/webapp/src/app/core/core.module.ts   | 24 ++++++++++++++++++--
 .../src/main/resources/webapp/tsconfig.json        |  3 ++-
 3 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/app.module.ts b/services/self-service/src/main/resources/webapp/src/app/app.module.ts
index 0caf8eb..a010587 100644
--- a/services/self-service/src/main/resources/webapp/src/app/app.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/app.module.ts
@@ -22,14 +22,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { RouterModule } from '@angular/router';
 import { BrowserModule } from '@angular/platform-browser';
 import { LocationStrategy, HashLocationStrategy } from '@angular/common';
-import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
+import { HttpClientModule } from '@angular/common/http';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { ToastrModule } from 'ngx-toastr';
 
-import { HttpTokenInterceptor } from './core/interceptors/http.token.interceptor';
-import { NoCacheInterceptor } from './core/interceptors/nocache.interceptor';
-import { ErrorInterceptor } from './core/interceptors/error.interceptor';
-
 import { AppComponent } from './app.component';
 import { AppRoutingModule } from './app.routing.module';
 
@@ -69,22 +65,10 @@ import { CoreModule } from './core/core.module';
     ToastrModule.forRoot({ timeOut: 10000 })
   ],
   providers: [{
-      provide: LocationStrategy,
-      useClass: HashLocationStrategy,
-      useValue: '/'
-    }, {
-      provide: HTTP_INTERCEPTORS,
-      useClass: HttpTokenInterceptor,
-      multi: true
-    }, {
-      provide: HTTP_INTERCEPTORS,
-      useClass: NoCacheInterceptor,
-      multi: true,
-    }, {
-      provide: HTTP_INTERCEPTORS,
-      useClass: ErrorInterceptor,
-      multi: true,
-    }
+    provide: LocationStrategy,
+    useClass: HashLocationStrategy,
+    useValue: '/'
+  }
   ],
   bootstrap: [AppComponent]
 })
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
index e182467..a847ef4 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
@@ -18,6 +18,8 @@
  */
 
 import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
+import { HTTP_INTERCEPTORS } from '@angular/common/http';
+
 import { CommonModule } from '@angular/common';
 import { ApplicationServiceFacade } from './services/applicationServiceFacade.service';
 import { AppRoutingService } from './services/appRouting.service';
@@ -40,6 +42,10 @@ import { StorageService } from './services/storage.service';
 import { ProjectService } from './services/project.service';
 import { EndpointService } from './services/endpoint.service';
 
+import { HttpTokenInterceptor } from './interceptors/http.token.interceptor';
+import { NoCacheInterceptor } from './interceptors/nocache.interceptor';
+import { ErrorInterceptor } from './interceptors/error.interceptor';
+
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
 
 @NgModule({
@@ -77,12 +83,26 @@ export class CoreModule {
         EndpointService,
 
         { provide: MatDialogRef, useValue: {} },
-        { provide: MAT_DIALOG_DATA, useValue: [] }
+        { provide: MAT_DIALOG_DATA, useValue: [] },
+
+        {
+          provide: HTTP_INTERCEPTORS,
+          useClass: HttpTokenInterceptor,
+          multi: true
+        }, {
+          provide: HTTP_INTERCEPTORS,
+          useClass: NoCacheInterceptor,
+          multi: true,
+        }, {
+          provide: HTTP_INTERCEPTORS,
+          useClass: ErrorInterceptor,
+          multi: true,
+        }
       ]
     };
   }
 
-  constructor (@Optional() @SkipSelf() parentModule: CoreModule) {
+  constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
     if (parentModule)
       throw new Error('CoreModule is already loaded. Import it in the AppModule only');
   }
diff --git a/services/self-service/src/main/resources/webapp/tsconfig.json b/services/self-service/src/main/resources/webapp/tsconfig.json
index 6150693..403043b 100644
--- a/services/self-service/src/main/resources/webapp/tsconfig.json
+++ b/services/self-service/src/main/resources/webapp/tsconfig.json
@@ -16,5 +16,6 @@
   "angularCompilerOptions": {
     // "fullTemplateTypeCheck": true,
     // "preserveWhitespaces": true
-  }
+  },
+  "skipLibCheck": true
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org