Add button to edit publications on publication view page.

This commit is contained in:
Florian THIERRY
2024-08-25 12:02:52 +02:00
parent f00fb103ba
commit 4d20d5f8b8
5 changed files with 51 additions and 28 deletions

View File

@@ -40,7 +40,6 @@
</mat-tab>
</mat-tab-group>
<footer>
<app-submit-button label="Save" [requestPending]="(isSaving$ | async) == true"></app-submit-button>
<button type="button" class="secondary" (click)="goPreviousLocation()">

View File

@@ -128,17 +128,16 @@ export class PublicationEditionService implements OnDestroy {
const publication = this._publication;
this.isSavingSubject.next(true);
setTimeout(() => this.isSavingSubject.next(false), 1500);
// this.publicationRestService.update(publication)
// .then(() => {
// this.snackBar.open('Publication updated succesfully!', 'Close', { duration: 5000 });
// this.router.navigate(['/home']);
// })
// .catch(error => {
// const errorMessage = 'An error occured while saving publication modifications.';
// console.error(errorMessage, error);
// this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
// })
// .finally(() => this.isSavingSubject.next(false));
this.publicationRestService.update(publication)
.then(() => {
this.snackBar.open('Publication updated succesfully!', 'Close', { duration: 5000 });
this.router.navigate(['/home']);
})
.catch(error => {
const errorMessage = 'An error occured while saving publication modifications.';
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
})
.finally(() => this.isSavingSubject.next(false));
}
}