Skip to content

Commit d9baebd

Browse files
authored
fix: wrong attributes added to next's forms (#306)
1 parent 112c341 commit d9baebd

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/generators/NextGenerator.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ export default class NextGenerator extends BaseGenerator {
122122
return {
123123
...list,
124124
[field.name]: {
125-
notrequired: !field.required,
126-
name: field.name,
125+
...field,
127126
type: this.getType(field),
128127
description: this.getDescription(field),
129128
readonly: false,
130-
reference: field.reference,
131129
},
132130
};
133131
}, {});

templates/next/components/foo/Form.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
2525
}
2626
};
2727

28+
const renderForm
29+
2830
return (
2931
<div>
3032
<h1>{ {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` }</h1>
@@ -84,14 +86,13 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
8486
onChange={handleChange}
8587
onBlur={handleBlur}
8688
/>
89+
<ErrorMessage
90+
className="invalid-feedback"
91+
component="div"
92+
name="{{name}}"
93+
/>
8794
</div>
88-
<ErrorMessage
89-
className="text-danger"
90-
component="div"
91-
name="{{name}}"
92-
/>
9395
{{/each}}
94-
9596
{status && status.msg && (
9697
<div
9798
className={`alert ${
@@ -102,7 +103,6 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
102103
{status.msg}
103104
</div>
104105
)}
105-
106106
<button
107107
type="submit"
108108
className="btn btn-success"

0 commit comments

Comments
 (0)