fix builder when field areas key is undefined

This commit is contained in:
Alex Turchyn
2023-07-26 23:47:35 +03:00
parent 7779eb880d
commit 08c3b04511
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -136,7 +136,7 @@
<p>
<button
class="base-button"
@click="drawField = false"
@click="drawField = null"
>
Cancel
</button>
@@ -421,7 +421,7 @@ export default {
}
this.template.fields.forEach((field) => {
[...field.areas].forEach((area) => {
[...(field.areas || [])].forEach((area) => {
if (area.attachment_uuid === item.attachment_uuid) {
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.documents.push(...documents)
this.template.fields.forEach((field) => {
field.areas.forEach((area) => {
(field.areas || []).forEach((area) => {
if (area.attachment_uuid === replaceSchemaItem.attachment_uuid) {
area.attachment_uuid = schema[0].attachment_uuid
}
@@ -172,6 +172,7 @@ export default {
name: '',
uuid: v4(),
required: type !== 'checkbox',
areas: [],
submitter_uuid: this.selectedSubmitter.uuid,
type
}