Commit a16a23cd authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Handle errors when creating a custom stage

parent a675cc81
......@@ -70,13 +70,16 @@ export default {
errors: {
type: Object,
required: false,
default: () => ({}),
default: null,
},
},
data() {
const defaultErrors = this?.initialFields?.endEventIdentifier
? {}
: { endEventIdentifier: [s__('CustomCycleAnalytics|Please select a start event first')] };
? { ...defaultFields, endEventIdentifier: null }
: {
...defaultFields,
endEventIdentifier: [s__('CustomCycleAnalytics|Please select a start event first')],
};
return {
labelEvents: getLabelEventsIdentifiers(this.events),
fields: {
......@@ -84,9 +87,8 @@ export default {
...this.initialFields,
},
fieldErrors: {
...defaultFields,
...this.errors,
...defaultErrors,
...this.errors,
},
};
},
......@@ -167,6 +169,8 @@ export default {
},
watch: {
initialFields(newFields) {
console.log('newFields', newFields);
this.fields = {
...defaultFields,
...newFields,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment