Fix authentication errors handling.

This commit is contained in:
Florian THIERRY
2024-09-03 11:45:47 +02:00
parent 4d44b6f53c
commit b091dc52b7
8 changed files with 120 additions and 44 deletions
@@ -31,9 +31,13 @@ export class PictureSelectionDialog implements OnInit {
this.pictures = pictures;
})
.catch(error => {
const errorMessage = 'An error occured while loading pictures.';
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
if (error.status === 401) {
this.dialogRef.close();
} else {
const errorMessage = 'An error occured while loading pictures.';
console.error(errorMessage, error);
this.snackBar.open(errorMessage, 'Close', { duration: 5000 });
}
})
.finally(() => {
this.isLoading = false;