Skip to content

Commit

Permalink
feat: run formatter/prettier on launchpad's generated code in Editor (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin101Zhang committed Aug 6, 2024
1 parent 24eac56 commit e67d2da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/src/components/Editor/EditorComponents/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const Editor: React.FC = (): ReactElement => {
const data = await response.json();

if (!data.hasOwnProperty('jsCode') || !data.hasOwnProperty('sqlCode')) {
throw new Error('No code was returned from the server');
throw new Error('No code was returned from the server with properties jsCode and sqlCode');
}

return data;
Expand All @@ -151,8 +151,9 @@ const Editor: React.FC = (): ReactElement => {
}

const codeResponse = await generateCode(wizardContractFilter, wizardMethods, wizardEvents);
setIndexingCode(codeResponse.jsCode);
setSchema(codeResponse.sqlCode);
const { validatedCode, validatedSchema } = reformatAll(codeResponse.jsCode, codeResponse.sqlCode);
validatedCode && setIndexingCode(validatedCode);
validatedSchema && setSchema(validatedSchema);
} catch (error: unknown) {
//todo: figure out best course of action for user if api fails
console.error(error);
Expand Down

0 comments on commit e67d2da

Please sign in to comment.