Fix deleting one-2-many relationships
This commit is contained in:
parent
17ecace6fa
commit
c5e52f7cbe
|
@ -340,10 +340,16 @@ export class ExternalRequest<T extends Operation> {
|
||||||
// one to many
|
// one to many
|
||||||
if (isOneSide(field)) {
|
if (isOneSide(field)) {
|
||||||
let id = row[key][0]
|
let id = row[key][0]
|
||||||
if (typeof row[key] === "string") {
|
if (id) {
|
||||||
id = decodeURIComponent(row[key]).match(/\[(.*?)\]/)?.[1]
|
if (typeof row[key] === "string") {
|
||||||
|
id = decodeURIComponent(row[key]).match(/\[(.*?)\]/)?.[1]
|
||||||
|
}
|
||||||
|
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(id)[0]
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
row[field.foreignKey || linkTablePrimary] = null
|
||||||
|
newRow[field.foreignKey || linkTablePrimary] = null
|
||||||
}
|
}
|
||||||
newRow[field.foreignKey || linkTablePrimary] = breakRowIdField(id)[0]
|
|
||||||
}
|
}
|
||||||
// many to many
|
// many to many
|
||||||
else if (field.through) {
|
else if (field.through) {
|
||||||
|
|
Loading…
Reference in New Issue