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 { ...@@ -70,13 +70,16 @@ export default {
errors: { errors: {
type: Object, type: Object,
required: false, required: false,
default: () => ({}), default: null,
}, },
}, },
data() { data() {
const defaultErrors = this?.initialFields?.endEventIdentifier const defaultErrors = this?.initialFields?.endEventIdentifier
? {} ? { ...defaultFields, endEventIdentifier: null }
: { endEventIdentifier: [s__('CustomCycleAnalytics|Please select a start event first')] }; : {
...defaultFields,
endEventIdentifier: [s__('CustomCycleAnalytics|Please select a start event first')],
};
return { return {
labelEvents: getLabelEventsIdentifiers(this.events), labelEvents: getLabelEventsIdentifiers(this.events),
fields: { fields: {
...@@ -84,9 +87,8 @@ export default { ...@@ -84,9 +87,8 @@ export default {
...this.initialFields, ...this.initialFields,
}, },
fieldErrors: { fieldErrors: {
...defaultFields,
...this.errors,
...defaultErrors, ...defaultErrors,
...this.errors,
}, },
}; };
}, },
...@@ -167,6 +169,8 @@ export default { ...@@ -167,6 +169,8 @@ export default {
}, },
watch: { watch: {
initialFields(newFields) { initialFields(newFields) {
console.log('newFields', newFields);
this.fields = { this.fields = {
...defaultFields, ...defaultFields,
...newFields, ...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