mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
add primitive error ajax error handling for visits page
This commit is contained in:
parent
3c4d95edcf
commit
a849f8ef0b
1 changed files with 5 additions and 2 deletions
|
@ -26,8 +26,11 @@ angular.module("visits").component("visits", {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
$http.post(url, data).then(function() {
|
$http.post(url, data).then(function() {
|
||||||
$location.url("owners/" + $routeParams.ownerId);
|
$location.url("owners/" + $routeParams.ownerId);
|
||||||
}, function() {
|
}, function (response) {
|
||||||
|
var error = response.data;
|
||||||
|
alert(error.error + "\r\n" + error.errors.map(function (e) {
|
||||||
|
return e.field + ": " + e.defaultMessage;
|
||||||
|
}).join("\r\n"));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue