fix: form submission error

This commit is contained in:
chenos 2021-03-24 16:55:08 +08:00
parent bb5aa17106
commit 859e1e0a04

View File

@ -28,7 +28,7 @@ export function Create(props) {
onReset={resolve}
onDraft={async (item) => {
const values = transform ? {} : item;
for (const [sourceKey, targetKey] of Object.entries<string>(transform)) {
for (const [sourceKey, targetKey] of Object.entries<string>(transform || {})) {
const value = get({ data: item }, sourceKey);
set(values, targetKey, value);
}
@ -38,7 +38,7 @@ export function Create(props) {
}}
onFinish={async (item) => {
const values = transform ? {} : item;
for (const [sourceKey, targetKey] of Object.entries<string>(transform)) {
for (const [sourceKey, targetKey] of Object.entries<string>(transform || {})) {
const value = get({ data: item }, sourceKey);
set(values, targetKey, value);
}