diff --git a/package.json b/package.json index 71686a6..71f4964 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "@auth0/auth0-react": "1.10.2", "@emotion/react": "11.7.1", "@emotion/styled": "11.6.0", - "@kingsrook/qqq-frontend-core": "1.0.89", + "@kingsrook/qqq-frontend-core": "1.0.90", "@mui/icons-material": "5.4.1", "@mui/material": "5.11.1", "@mui/styles": "5.11.1", diff --git a/src/qqq/components/forms/EntityForm.tsx b/src/qqq/components/forms/EntityForm.tsx index f990fc9..74f24f0 100644 --- a/src/qqq/components/forms/EntityForm.tsx +++ b/src/qqq/components/forms/EntityForm.tsx @@ -759,7 +759,9 @@ function EntityForm(props: Props): JSX.Element if (props.id !== null && !props.isCopy) { - // todo - audit that it's a dupe + /////////////////////// + // perform an update // + /////////////////////// await qController .update(tableName, props.id, valuesToPost) .then((record) => @@ -770,8 +772,14 @@ function EntityForm(props: Props): JSX.Element } else { + let warningMessage = null; + if(record.warnings && record.warnings.length && record.warnings.length > 0) + { + warningMessage = record.warnings[0]; + } + const path = location.pathname.replace(/\/edit$/, ""); - navigate(path, {state: {updateSuccess: true}}); + navigate(path, {state: {updateSuccess: true, warning: warningMessage}}); } }) .catch((error) => @@ -793,6 +801,10 @@ function EntityForm(props: Props): JSX.Element } else { + ///////////////////////////////// + // perform an insert // + // todo - audit if it's a dupe // + ///////////////////////////////// await qController .create(tableName, valuesToPost) .then((record) => @@ -803,10 +815,16 @@ function EntityForm(props: Props): JSX.Element } else { + let warningMessage = null; + if(record.warnings && record.warnings.length && record.warnings.length > 0) + { + warningMessage = record.warnings[0]; + } + const path = props.isCopy ? location.pathname.replace(new RegExp(`/${props.id}/copy$`), "/" + record.values.get(tableMetaData.primaryKeyField)) : location.pathname.replace(/create$/, record.values.get(tableMetaData.primaryKeyField)); - navigate(path, {state: {createSuccess: true}}); + navigate(path, {state: {createSuccess: true, warning: warningMessage}}); } }) .catch((error) =>