From de4d4d05b2594f0cc70863af40e9c2658e3da9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Montigny?= Date: Tue, 1 Aug 2023 17:07:39 +0200 Subject: [PATCH] clean material module we import --- front/src/app/app.component.ts | 6 ++++- .../src/app/components/popup/popup.module.ts | 11 --------- front/src/app/libs/material.module.ts | 23 +------------------ front/src/app/services/user/user.service.ts | 2 +- 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/front/src/app/app.component.ts b/front/src/app/app.component.ts index c82c1d67f..b67841b41 100644 --- a/front/src/app/app.component.ts +++ b/front/src/app/app.component.ts @@ -103,7 +103,11 @@ export class AppComponent implements AfterViewInit { * Control si on est en SSL ou non */ onControlSSL() { - if (location.protocol !== 'https:' && environment.forceSSL) { + if ( + location.protocol !== 'https:' && + location.hostname !== 'localhost' && + environment.forceSSL + ) { location.replace( `https:${location.href.substring(location.protocol.length)}` ) diff --git a/front/src/app/components/popup/popup.module.ts b/front/src/app/components/popup/popup.module.ts index 1a772b983..8f36feae0 100644 --- a/front/src/app/components/popup/popup.module.ts +++ b/front/src/app/components/popup/popup.module.ts @@ -1,11 +1,6 @@ import { NgModule } from '@angular/core' import { CommonModule } from '@angular/common' -import { RouterModule } from '@angular/router' import { PopupComponent } from './popup.component' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { MaterialModule } from 'src/app/libs/material.module' -import { PipesModule } from 'src/app/pipes/pipes.module' -import { NgSelectModule } from '@ng-select/ng-select' /** * Liste des composants à importer @@ -21,12 +16,6 @@ const list = [ declarations: [...list], imports: [ CommonModule, - RouterModule, - FormsModule, - ReactiveFormsModule, - MaterialModule, - PipesModule, - NgSelectModule, ], exports: list, }) diff --git a/front/src/app/libs/material.module.ts b/front/src/app/libs/material.module.ts index 96d3d3224..8ab44f685 100644 --- a/front/src/app/libs/material.module.ts +++ b/front/src/app/libs/material.module.ts @@ -1,30 +1,18 @@ import { NgModule } from '@angular/core' import { MatInputModule } from '@angular/material/input' import { - MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS, } from '@angular/material/form-field' import { MatButtonModule } from '@angular/material/button' -import { MatCardModule } from '@angular/material/card' -import { - MatSnackBarModule, - MAT_SNACK_BAR_DEFAULT_OPTIONS, -} from '@angular/material/snack-bar' -import { MatTableModule } from '@angular/material/table' import { MatIconModule } from '@angular/material/icon' -import { MatDialogModule } from '@angular/material/dialog' import { MatSelectModule } from '@angular/material/select' -import { MatSortModule } from '@angular/material/sort' import { MatDatepickerModule } from '@angular/material/datepicker' -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner' -import { DragDropModule } from '@angular/cdk/drag-drop' import { MatTooltipDefaultOptions, MatTooltipModule, MAT_TOOLTIP_DEFAULT_OPTIONS, } from '@angular/material/tooltip' import { MatMenuModule } from '@angular/material/menu' -import { MatButtonToggleModule } from '@angular/material/button-toggle' import { MatCheckboxModule } from '@angular/material/checkbox' import { MatNativeDateModule, @@ -67,21 +55,12 @@ export const MY_FORMATS = { */ @NgModule({ exports: [ - MatButtonToggleModule, MatInputModule, - MatFormFieldModule, MatButtonModule, - MatCardModule, - MatSnackBarModule, - MatTableModule, MatIconModule, - MatDialogModule, MatSelectModule, - MatSortModule, MatDatepickerModule, MatNativeDateModule, - MatProgressSpinnerModule, - DragDropModule, MatTooltipModule, MatMenuModule, MatCheckboxModule, @@ -92,9 +71,9 @@ export const MY_FORMATS = { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'fill' }, }, - { provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 2500 } }, { provide: MAT_DATE_LOCALE, useValue: 'fr-FR' }, { provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: myCustomTooltipDefaults }, + { provide: DateAdapter, useClass: MomentDateAdapter, diff --git a/front/src/app/services/user/user.service.ts b/front/src/app/services/user/user.service.ts index ca1fa7570..c4b2767b8 100644 --- a/front/src/app/services/user/user.service.ts +++ b/front/src/app/services/user/user.service.ts @@ -52,7 +52,7 @@ export class UserService { * @returns */ me() { - return this.serverService.get('users/me').then((data) => data.data || null) + return this.serverService.getWithoutError('users/me').then((data) => data.data || null) } /**