From 34acfc51a55e569e211b45b55923b56cd374d1c1 Mon Sep 17 00:00:00 2001 From: Bastien Dumont <bdumont@grandlyon.com> Date: Wed, 19 Apr 2023 14:50:17 +0200 Subject: [PATCH] chore: remove empty optional parameter --- .../manage-employers.component.ts | 2 +- .../manage-jobs/manage-jobs.component.ts | 4 ++-- .../manage-users/manage-users.component.ts | 2 +- src/app/form/form-view/form-view.component.ts | 2 +- src/app/profile/edit/edit.component.ts | 10 +++++----- src/app/profile/profile.component.ts | 4 ++-- src/app/profile/services/profile.service.ts | 18 ++++++++---------- .../structure-edition-summary.component.ts | 2 +- src/app/services/notification.service.ts | 18 +++++++++--------- 9 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/app/admin/components/manage-employers/manage-employers.component.ts b/src/app/admin/components/manage-employers/manage-employers.component.ts index dbd7450b5..28b3db9af 100644 --- a/src/app/admin/components/manage-employers/manage-employers.component.ts +++ b/src/app/admin/components/manage-employers/manage-employers.component.ts @@ -144,7 +144,7 @@ export class ManageEmployersComponent implements OnInit { () => { this.findValidatedEmployers(); this.newEmployerForm.reset(); - this.notificationService.showSuccess('Votre employeur a bien été créée', ''); + this.notificationService.showSuccess('Votre employeur a bien été créée'); }, (err) => { this.notificationService.showError(`${err.error.message}`, 'Une erreur est survenue'); diff --git a/src/app/admin/components/manage-jobs/manage-jobs.component.ts b/src/app/admin/components/manage-jobs/manage-jobs.component.ts index 9c97fd7d2..5b673e258 100644 --- a/src/app/admin/components/manage-jobs/manage-jobs.component.ts +++ b/src/app/admin/components/manage-jobs/manage-jobs.component.ts @@ -173,7 +173,7 @@ export class ManageJobsComponent implements OnInit { () => { this.findValidatedJobs(); this.newJobForm.reset(); - this.notificationService.showSuccess('Votre fonction a bien été créée', ''); + this.notificationService.showSuccess('Votre fonction a bien été créée'); }, (err) => { this.notificationService.showError(`${err.error.message}`, 'Une erreur est survenue'); @@ -191,7 +191,7 @@ export class ManageJobsComponent implements OnInit { this.adminService.deleteJob(job._id).subscribe( (data) => { this.validatedJobs = this.validatedJobs.filter((obj) => obj._id !== data._id); - this.notificationService.showSuccess('La fonction a bien été supprimée.', ''); + this.notificationService.showSuccess('La fonction a bien été supprimée.'); }, (err) => { this.notificationService.showError(`${err.error.message}`, 'Une erreur est survenue'); diff --git a/src/app/admin/components/manage-users/manage-users.component.ts b/src/app/admin/components/manage-users/manage-users.component.ts index e3f20df86..5c2cf6c9d 100644 --- a/src/app/admin/components/manage-users/manage-users.component.ts +++ b/src/app/admin/components/manage-users/manage-users.component.ts @@ -161,7 +161,7 @@ export class ManageUsersComponent { arg.node.data[arg.colDef.field] = selectedJob; arg.api.refreshCells({ rowNodes: [arg.node], columns: [arg.column.colId] }); - this.notificationService.showSuccess('La fonction a bien été attribuée.', ''); + this.notificationService.showSuccess('La fonction a bien été attribuée.'); }); return; } diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index 720f12a74..4b4df7531 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -389,7 +389,7 @@ export class FormViewComponent implements OnInit, AfterViewInit { public async saveEditedStructure() { this.structureService.editStructure(this.getCurrentChanges(this.currentPage), this.structure._id).subscribe(() => { - this.notificationService.showSuccess('Vos modifications ont bien été prises en compte.', ''); + this.notificationService.showSuccess('Vos modifications ont bien été prises en compte.'); history.back(); }); } diff --git a/src/app/profile/edit/edit.component.ts b/src/app/profile/edit/edit.component.ts index b6a29c94b..3e7790eed 100644 --- a/src/app/profile/edit/edit.component.ts +++ b/src/app/profile/edit/edit.component.ts @@ -263,7 +263,7 @@ export class EditComponent implements OnInit { if (this.emailValid(this.newEmail) && this.newEmail === this.newEmailConfirm) { this.profileService.changeEmail(this.newEmail, this.userProfile.email).subscribe(() => { this.closeModal(); - this.notificationService.showSuccess('Veuillez confirmer votre nouvelle adresse grâce au mail envoyé', ''); + this.notificationService.showSuccess('Veuillez confirmer votre nouvelle adresse grâce au mail envoyé'); }); } } @@ -275,13 +275,13 @@ export class EditComponent implements OnInit { .pipe( catchError(async (response: HttpErrorResponse) => { if (response.error.statusCode == 401) { - this.notificationService.showError('Une erreur est survenue', ''); + this.notificationService.showError('Une erreur est survenue'); throw new Error('Une erreur est survenue'); } }) ) .subscribe(() => { - this.notificationService.showSuccess('Votre mot de passe a bien été modifié', ''); + this.notificationService.showSuccess('Votre mot de passe a bien été modifié'); this.closeModal(); }); this.oldPassword = ''; @@ -296,13 +296,13 @@ export class EditComponent implements OnInit { .subscribe( () => { this.profileService.deleteProfile().subscribe(() => { - this.notificationService.showSuccess('Votre compte a bien été supprimé', ''); + this.notificationService.showSuccess('Votre compte a bien été supprimé'); this.closeModal(); this.authService.logout(); }); }, () => { - this.notificationService.showError('Une erreur est survenue', ''); + this.notificationService.showError('Une erreur est survenue'); } ); } diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index c0a19627b..ccf783c71 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -1,7 +1,7 @@ import { Location } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { forkJoin, Observable } from 'rxjs'; +import { Observable, forkJoin } from 'rxjs'; import { catchError, map, tap } from 'rxjs/operators'; import { pendingStructureLink } from '../models/pendingStructure.model'; import { StructureWithOwners } from '../models/structureWithOwners.model'; @@ -112,7 +112,7 @@ export class ProfileComponent implements OnInit { next: () => { const index = this.pendingStructures.map((s) => s.structure._id).indexOf(idStructure); this.pendingStructures.splice(index, 1); - this.notificationService.showSuccess('La demande a été annulée avec succès', ''); + this.notificationService.showSuccess('La demande a été annulée avec succès'); }, error: (err) => { this.notificationService.showError(`${err.error.message}`, 'Une erreur est survenue'); diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts index 0925fa451..a7dea50d1 100644 --- a/src/app/profile/services/profile.service.ts +++ b/src/app/profile/services/profile.service.ts @@ -110,22 +110,20 @@ export class ProfileService { return this.http.post<User>(`${this.baseUrl}/details`, newDetails).pipe( map((user) => user), catchError(() => { - this.notificationService.showError('Une erreur est survenue', ''); + this.notificationService.showError('Une erreur est survenue'); return new Observable<Error>(); }) ); } public updateDescription(description: string): Observable<User | Error> { - return this.http - .post<User>(`${this.baseUrl}/description`, { description }) - .pipe( - map((user) => user), - catchError(() => { - this.notificationService.showError('Une erreur est survenue', ''); - return new Observable<Error>(); - }) - ); + return this.http.post<User>(`${this.baseUrl}/description`, { description }).pipe( + map((user) => user), + catchError(() => { + this.notificationService.showError('Une erreur est survenue'); + return new Observable<Error>(); + }) + ); } public async isPersonalOfferOwner(personalOfferId: string): Promise<boolean> { diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index f4a6562b4..695642504 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -95,7 +95,7 @@ export class StructureEditionSummaryComponent implements OnInit { public updateStructureUpdateDate(): void { this.structureService.editStructure({}, this.structure._id).subscribe(() => { - this.notificationService.showSuccess('La structure a bien été mise à jour.', ''); + this.notificationService.showSuccess('La structure a bien été mise à jour.'); this.isUpdateStructure = false; }); } diff --git a/src/app/services/notification.service.ts b/src/app/services/notification.service.ts index 11ce28ce7..1ce856f0c 100644 --- a/src/app/services/notification.service.ts +++ b/src/app/services/notification.service.ts @@ -7,24 +7,24 @@ import { ToastrService } from 'ngx-toastr'; export class NotificationService { constructor(private toastr: ToastrService) {} - public showSuccess(message: string, title: string = '', timespan: number = 10000): void { + public showSuccess(message: string, title: string = '', timeOut: number = 10000): void { this.toastr.success(message, title, { - timeOut: timespan, + timeOut: timeOut, }); } - // Par defaut, l'erreur reste affichée jusqu'à ce qu'on clique dessus - public showError(message: string, title: string = '', timespan: number = 0): void { + // Par défaut, l'erreur reste affichée jusqu'à ce qu'on clique dessus + public showError(message: string, title: string = '', timeOut: number = 0): void { this.toastr.error(message, title, { - timeOut: timespan, - disableTimeOut: timespan ? false : true, + timeOut: timeOut, + disableTimeOut: timeOut ? false : true, }); } - public showErrorPleaseRetry(title: string, timespan: number = 0): void { - this.showError('Merci de réessayer plus tard ou de contacter un administrateur', title, timespan); + public showErrorPleaseRetry(title: string, timeOut: number = 0): void { + this.showError('Merci de réessayer plus tard ou de contacter un administrateur', title, timeOut); } - // Par defaut, l'erreur reste affichée jusqu'à ce qu'on clique dessus + // Par défaut, l'erreur reste affichée jusqu'à ce qu'on clique dessus public showAppNewVersion(): void { const update = this.toastr.info( 'Une nouvelle version est disponible, cliquer ici pour mettre à jour.', -- GitLab