fix: useCreateActionProps & useUpdateActionProps
This commit is contained in:
parent
da9e08a59f
commit
0c2b9741ed
@ -49,11 +49,17 @@ export const useCreateActionProps = () => {
|
|||||||
if (fieldNames.includes(key)) {
|
if (fieldNames.includes(key)) {
|
||||||
const items = form.values[key];
|
const items = form.values[key];
|
||||||
const collectionField = getField(key);
|
const collectionField = getField(key);
|
||||||
const targetKey = collectionField.targetKey || 'id';
|
if (collectionField.interface === 'linkTo') {
|
||||||
if (Array.isArray(items)) {
|
const targetKey = collectionField.targetKey || 'id';
|
||||||
values[key] = items.map((item) => item[targetKey]);
|
if (Array.isArray(items)) {
|
||||||
} else if (items && typeof items === 'object') {
|
values[key] = items.map((item) => item[targetKey]);
|
||||||
values[key] = items[targetKey];
|
} else if (items && typeof items === 'object') {
|
||||||
|
values[key] = items[targetKey];
|
||||||
|
} else {
|
||||||
|
values[key] = items[targetKey];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values[key] = form.values[key];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
values[key] = form.values[key];
|
values[key] = form.values[key];
|
||||||
@ -118,6 +124,8 @@ export const useUpdateActionProps = () => {
|
|||||||
values[key] = items.map((item) => item[targetKey]);
|
values[key] = items.map((item) => item[targetKey]);
|
||||||
} else if (items && typeof items === 'object') {
|
} else if (items && typeof items === 'object') {
|
||||||
values[key] = items[targetKey];
|
values[key] = items[targetKey];
|
||||||
|
} else {
|
||||||
|
values[key] = items[targetKey];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
values[key] = form.values[key];
|
values[key] = form.values[key];
|
||||||
|
Loading…
Reference in New Issue
Block a user