diff --git a/front-public/src/app/pages/api-detail/api-detail.component.ts b/front-public/src/app/pages/api-detail/api-detail.component.ts index a78d279..d5d9a72 100644 --- a/front-public/src/app/pages/api-detail/api-detail.component.ts +++ b/front-public/src/app/pages/api-detail/api-detail.component.ts @@ -242,13 +242,19 @@ import { ApiEntry, Category } from '@datacat/shared'; @if (editError()) {

{{ editError() }}

} -
+
- + + @if (editTitleError()) {

Le titre est obligatoire.

}
-
+
- + + @if (editVersionError()) {

La version est obligatoire.

}
@@ -315,6 +321,8 @@ export class ApiDetailComponent implements OnInit, OnDestroy { showEditModal = signal(false); editLoading = signal(false); editError = signal(null); + editTitleError = signal(false); + editVersionError = signal(false); categories = signal([]); editTitle = signal(''); editVersion = signal(''); @@ -365,6 +373,8 @@ export class ApiDetailComponent implements OnInit, OnDestroy { this.editContactTechnical.set(entry.contactTechnical ?? ''); this.editAccessRights.set(entry.accessRights ?? ''); this.editError.set(null); + this.editTitleError.set(false); + this.editVersionError.set(false); this.categoryService.list().subscribe((res) => this.categories.set(res.items)); this.showEditModal.set(true); } @@ -374,10 +384,9 @@ export class ApiDetailComponent implements OnInit, OnDestroy { } submitEdit() { - if (!this.editTitle().trim() || !this.editVersion().trim()) { - this.editError.set('Le titre et la version sont obligatoires.'); - return; - } + this.editTitleError.set(!this.editTitle().trim()); + this.editVersionError.set(!this.editVersion().trim()); + if (!this.editTitle().trim() || !this.editVersion().trim()) return; this.editLoading.set(true); this.apiService.update(this.id, { title: this.editTitle().trim(), diff --git a/front-public/src/app/pages/browse/browse.component.ts b/front-public/src/app/pages/browse/browse.component.ts index 7fb4166..298aa05 100644 --- a/front-public/src/app/pages/browse/browse.component.ts +++ b/front-public/src/app/pages/browse/browse.component.ts @@ -246,13 +246,15 @@ import { forkJoin } from 'rxjs';

{{ formError() }}

} -
+
- + (input)="formName.set($any($event.target).value); formNameError.set(false)" + (blur)="formNameError.set(!formName().trim())" /> + @if (formNameError()) {

Le nom est obligatoire.

}