mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
vuejs: better violations message in 422 error handling
This commit is contained in:
parent
378f3a16fc
commit
40e4bf953f
@ -85,8 +85,9 @@ const fetchScopes = () => {
|
|||||||
const ValidationException = (response) => {
|
const ValidationException = (response) => {
|
||||||
const error = {};
|
const error = {};
|
||||||
error.name = 'ValidationException';
|
error.name = 'ValidationException';
|
||||||
error.violations = response.violations.map((violation) => `${violation.title}`);
|
error.violations = response.violations.map((violation) => `${violation.title}: ${violation.propertyPath}`);
|
||||||
error.propertyPaths = response.violations.map((violation) => `${violation.propertyPath}`);
|
error.titles = response.violations.map((violation) => violation.title);
|
||||||
|
error.propertyPaths = response.violations.map((violation) => violation.propertyPath);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -275,8 +275,8 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
//commit('catchError', error);
|
//commit('catchError', error);
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
for (let e of error.propertyPaths) {
|
for (let v of error.violations) {
|
||||||
this.$toast.open({message: `${e}` }); //TODO better exploit violations messages
|
this.$toast.open({message: v });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$toast.open({message: 'An error occurred'});
|
this.$toast.open({message: 'An error occurred'});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user