Browse Source

interceptor to core

pull/11365/head
mpetrov 2 years ago
parent
commit
5813722a0e
  1. 5
      ui-ngx/src/app/app.module.ts
  2. 6
      ui-ngx/src/app/core/core.module.ts
  3. 0
      ui-ngx/src/app/core/interceptors/entity-conflict.interceptor.ts
  4. 17
      ui-ngx/src/app/shared/interceptors/public-api.ts
  5. 1
      ui-ngx/src/app/shared/public-api.ts

5
ui-ngx/src/app/app.module.ts

@ -26,8 +26,6 @@ import { HomeModule } from '@home/home.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { DashboardRoutingModule } from '@modules/dashboard/dashboard-routing.module'; import { DashboardRoutingModule } from '@modules/dashboard/dashboard-routing.module';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { EntityConflictInterceptor } from '@shared/interceptors/entity-conflict.interceptor';
const routes: Routes = [ const routes: Routes = [
{ path: '**', { path: '**',
@ -57,9 +55,6 @@ export class PageNotFoundRoutingModule { }
DashboardRoutingModule, DashboardRoutingModule,
PageNotFoundRoutingModule PageNotFoundRoutingModule
], ],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: EntityConflictInterceptor, multi: true }
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

6
ui-ngx/src/app/core/core.module.ts

@ -41,6 +41,7 @@ import { WINDOW_PROVIDERS } from '@core/services/window.service';
import { HotkeyModule } from 'angular2-hotkeys'; import { HotkeyModule } from 'angular2-hotkeys';
import { TranslateDefaultParser } from '@core/translate/translate-default-parser'; import { TranslateDefaultParser } from '@core/translate/translate-default-parser';
import { TranslateDefaultLoader } from '@core/translate/translate-default-loader'; import { TranslateDefaultLoader } from '@core/translate/translate-default-loader';
import { EntityConflictInterceptor } from '@core/interceptors/entity-conflict.interceptor';
@NgModule({ @NgModule({
imports: [ imports: [
@ -95,6 +96,11 @@ import { TranslateDefaultLoader } from '@core/translate/translate-default-loader
useClass: GlobalHttpInterceptor, useClass: GlobalHttpInterceptor,
multi: true multi: true
}, },
{
provide: HTTP_INTERCEPTORS,
useClass: EntityConflictInterceptor,
multi: true
},
{ {
provide: MAT_DIALOG_DEFAULT_OPTIONS, provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: { useValue: {

0
ui-ngx/src/app/shared/interceptors/entity-conflict.interceptor.ts → ui-ngx/src/app/core/interceptors/entity-conflict.interceptor.ts

17
ui-ngx/src/app/shared/interceptors/public-api.ts

@ -1,17 +0,0 @@
///
/// Copyright © 2016-2024 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
export * from './entity-conflict.interceptor';

1
ui-ngx/src/app/shared/public-api.ts

@ -19,4 +19,3 @@ export * from './decorators/public-api';
export * from './models/public-api'; export * from './models/public-api';
export * from './pipe/public-api'; export * from './pipe/public-api';
export * from './shared.module'; export * from './shared.module';
export * from './interceptors/public-api';

Loading…
Cancel
Save