Fix authentication errors handling.
This commit is contained in:
+7
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user