Merge pull request #18 from 1on/dev
fix: fixed removing array item in form data
This commit is contained in:
commit
91b928f144
@ -39,6 +39,10 @@ export function setNested (obj: Record<string, any>, field: string, value: any):
|
|||||||
const fieldPart = fieldParts[i]
|
const fieldPart = fieldParts[i]
|
||||||
const matches = fieldPart.match(/(.+)\[(\d+)\]$/)
|
const matches = fieldPart.match(/(.+)\[(\d+)\]$/)
|
||||||
|
|
||||||
|
if (subProxy === undefined) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
if (subProxy[matches[1]] === undefined) {
|
if (subProxy[matches[1]] === undefined) {
|
||||||
subProxy[matches[1]] = []
|
subProxy[matches[1]] = []
|
||||||
@ -52,9 +56,6 @@ export function setNested (obj: Record<string, any>, field: string, value: any):
|
|||||||
subProxy = subProxy[matches[2]]
|
subProxy = subProxy[matches[2]]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (subProxy === undefined) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if (i === fieldParts.length - 1) {
|
if (i === fieldParts.length - 1) {
|
||||||
subProxy[fieldPart] = value
|
subProxy[fieldPart] = value
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user