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 dbd7450b5fe1eb43ffe5fb847d010e57c073febc..28b3db9af02075f403b332fd352519d83bffe22e 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 9c97fd7d28e3c766834df81e617b71fb4aecc575..5b673e2588c797abf23622df9984212bb196a485 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 e3f20df86c0b4f7c16906bdfb7281c74e1c78558..5c2cf6c9db0c9b236e1ae1e4579242a891936a28 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 720f12a742b316980fe47b0176aefa1d05f26925..4b4df7531690498b894ca14e99f39e1aff017e5a 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 b6a29c94bff25b530593382dcb8c154d42d452ab..3e7790eedaf60b4ff5783c3d2309a6a9682f4ebb 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 c0a19627b9de4db44596867ebc7cfcf7fd14624d..ccf783c717e481dd1c4471214b6a300a0f5ff2d7 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 0925fa451ebf1894a8be15ec95e229c8051546df..a7dea50d123e3f25546a12adb475e6b03e2e1335 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 f4a6562b452ab4544e0c7f443b4b6d17c10edb64..695642504bb08940ee6e2ca15929a07df7a58f2e 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 11ce28ce76a69e20a8b0012d4c003cc78b0fcc6b..1ce856f0ce757bf77711cc427d8d03998fa2006f 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.',