Make Client.error() persistent and allow to pass an action

This commit is contained in:
Johannes Zellner
2019-09-05 23:59:38 +02:00
parent b6e00a3107
commit 21981829fd

View File

@@ -178,16 +178,18 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
this.setToken(localStorage.token);
}
Client.prototype.error = function (error) {
Client.prototype.error = function (error, action) {
var message = '';
console.error(error);
if (typeof error === 'object') {
message = error.message || error;
} else {
message = error;
}
Notification.error({ title: 'Cloudron Error', message: message });
this.notify('Cloudron Error', message, true, 'error', action);
};
// handles application startup errors, mostly only when dashboard is loaded and api endpoint is down