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