fix builder when field areas key is undefined

pull/105/head 1.0.5
Alex Turchyn 2 years ago
parent 7779eb880d
commit 08c3b04511

@ -136,7 +136,7 @@
<p> <p>
<button <button
class="base-button" class="base-button"
@click="drawField = false" @click="drawField = null"
> >
Cancel Cancel
</button> </button>
@ -421,7 +421,7 @@ export default {
} }
this.template.fields.forEach((field) => { this.template.fields.forEach((field) => {
[...field.areas].forEach((area) => { [...(field.areas || [])].forEach((area) => {
if (area.attachment_uuid === item.attachment_uuid) { if (area.attachment_uuid === item.attachment_uuid) {
field.areas.splice(field.areas.indexOf(area), 1) field.areas.splice(field.areas.indexOf(area), 1)
} }
@ -434,7 +434,7 @@ export default {
this.template.schema.splice(this.template.schema.indexOf(replaceSchemaItem), 1, schema[0]) this.template.schema.splice(this.template.schema.indexOf(replaceSchemaItem), 1, schema[0])
this.template.documents.push(...documents) this.template.documents.push(...documents)
this.template.fields.forEach((field) => { this.template.fields.forEach((field) => {
field.areas.forEach((area) => { (field.areas || []).forEach((area) => {
if (area.attachment_uuid === replaceSchemaItem.attachment_uuid) { if (area.attachment_uuid === replaceSchemaItem.attachment_uuid) {
area.attachment_uuid = schema[0].attachment_uuid area.attachment_uuid = schema[0].attachment_uuid
} }

@ -172,6 +172,7 @@ export default {
name: '', name: '',
uuid: v4(), uuid: v4(),
required: type !== 'checkbox', required: type !== 'checkbox',
areas: [],
submitter_uuid: this.selectedSubmitter.uuid, submitter_uuid: this.selectedSubmitter.uuid,
type type
} }

Loading…
Cancel
Save