Skip to content

Commit

Permalink
[React] Numeric field of an entity is sent as a string in the JSON vi…
Browse files Browse the repository at this point in the history
…a REST API
  • Loading branch information
qmonmert committed Oct 16, 2023
1 parent 7a5681a commit ec029f8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,18 @@ export const <%= entityReactName %>Update = () => {
}
}, [updateSuccess]);

// eslint-disable-next-line complexity
const saveEntity = values => {
<%_ for (field of fields.filter(field => !field.id)) {
<%_ for (field of fields) {
const fieldName = field.fieldName;
_%>
<%_ if (field.fieldTypeTimed) { _%>
values.<%= fieldName %> = convertDateTimeToServer(values.<%= fieldName %>);
<%_ } _%>
<%_ } else if (field.fieldTypeNumeric || field.id && !field.autoGenerate) { _%>
if (values.<%= fieldName %> !== undefined) {
values.<%= fieldName %> = Number(values.<%= fieldName %>);
}
<%_ } _%>
<%_ } _%>

const entity = {
Expand Down

0 comments on commit ec029f8

Please sign in to comment.