Skip to content

Commit

Permalink
adapt form
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Aug 29, 2024
1 parent 4beb60c commit 94ac2e2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export default {
);
if (validationError) {
this.error({status: 400, responseJSON: validationError});
} else {
} else if (data) {
this.success(data);
}
this.complete();
Expand Down
21 changes: 20 additions & 1 deletion src/components/ListPanel/counter/CounterReportsEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,26 @@ const {form, set} = useForm(props.activeForm, {
await fetch();
if (data.value) {
if (
validationError.value &&
Object.prototype.hasOwnProperty.call(validationError.value, 'Code')
) {
// COUNTER speific errors should actually not occur
// because of the form/user input validation
// but consider them for any case as well.
pkp.eventBus.$emit(
'notify',
validationError.value.Code +
': ' +
validationError.value.Message +
' (' +
validationError.value.Data +
')',
'warning',
);
validationError.value = null;
data.value = null;
} else if (data.value) {
var blob = new Blob([data.value]);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
Expand Down

0 comments on commit 94ac2e2

Please sign in to comment.