Skip to content

Commit 1a9d85c

Browse files
committed
push label non-field error messages to ui
1 parent 59b8564 commit 1a9d85c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

app/server/static/components/label.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,14 @@ export default {
263263
this.messages = [];
264264
})
265265
.catch((error) => {
266-
console.log(error); // eslint-disable-line no-console
267-
this.messages.push('You cannot use same label name or shortcut key.');
266+
console.log(error);
267+
if (error.response.data.non_field_errors) {
268+
error.response.data.non_field_errors.forEach((msg) => {
269+
this.messages.push(msg);
270+
});
271+
} else {
272+
this.messages.push('You cannot use same label name or shortcut key.');
273+
}
268274
});
269275
},
270276
@@ -312,7 +318,13 @@ export default {
312318
})
313319
.catch((error) => {
314320
console.log(error); // eslint-disable-line no-console
315-
this.messages.push('You cannot use same label name or shortcut key.');
321+
if (error.response.data.non_field_errors) {
322+
error.response.data.non_field_errors.forEach((msg) => {
323+
this.messages.push(msg);
324+
});
325+
} else {
326+
this.messages.push('You cannot use same label name or shortcut key.');
327+
}
316328
});
317329
},
318330

0 commit comments

Comments
 (0)