Added an dedicated error in case of a potential CORS issue #39
This commit is contained in:
parent
5a7f6bf87f
commit
de42f445b4
|
@ -34,7 +34,13 @@ export class AddNewAccountComponent implements OnInit {
|
|||
this.redirectToInstanceAuthPage(username, instance, appData);
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
if (err instanceof HttpErrorResponse) {
|
||||
this.notificationService.notifyHttpError(err);
|
||||
} else if ((<Error>err).message === 'CORS'){
|
||||
this.notificationService.notify('There is maybe a CORS issue with the server you\'re connecting to. Please check in the console and if so, contact your administrator with those informations.', true);
|
||||
} else {
|
||||
this.notificationService.notify('Unkown error', true);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
@ -53,6 +59,13 @@ export class AddNewAccountComponent implements OnInit {
|
|||
return this.saveNewApp(instance, appData)
|
||||
.then(() => { return appData; });
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
if (err.status === 0) {
|
||||
throw Error('CORS');
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
padding: 5px 10px;
|
||||
border-radius: 2px;
|
||||
margin: 0 0 5px 15px;
|
||||
max-width: 305px;
|
||||
white-space: pre-line;
|
||||
word-wrap: break-word;
|
||||
cursor: pointer;
|
||||
|
||||
&--error{
|
||||
|
|
|
@ -17,7 +17,7 @@ export class NotificationHubComponent implements OnInit {
|
|||
|
||||
setTimeout(() => {
|
||||
this.notifications = this.notifications.filter(x => x.id !== notification.id);
|
||||
}, 2000);
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
//this.autoSubmit();
|
||||
|
|
Loading…
Reference in New Issue