Skip to content

Commit

Permalink
fix: generating API
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowadz committed Aug 31, 2023
1 parent cf7db9e commit ff00240
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Model = ({
relationsProps,
justReturn,
id,
true
false
)
},
[props, name, amount, relations, relationsProps, id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const ModelHeader = ({
style={{ marginLeft: '5px' }}
onClick={async () => {
const data = await generate(true)
generateAPI(name, null, null, null, null, data, auth)
generateAPI(name, null, null, null, null, { [name]: data }, auth)
}}
>
Generate Restful API
Expand Down
3 changes: 2 additions & 1 deletion src/components/generate/components/Controller/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export const generate = (
// see https://stackoverflow.com/questions/29175877/json-stringify-throws-rangeerror-invalid-string-length-for-huge-objects
// stringify-ing the whole array might cause (RangeError: Invalid string length) error
// which means "Out Of Memory"
const outJSON = '[' + data.map((el) => toJSONPritty(el)).join(',') + ']'
const outJSON =
'[' + data.map((el: any) => toJSONPritty(el)).join(',') + ']'

if (justReturn) {
return outJSON
Expand Down

0 comments on commit ff00240

Please sign in to comment.