Skip to content

Commit

Permalink
use indexed templates in lgFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
yeze322 committed Dec 10, 2019
1 parent 530d944 commit a8f9015
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Composer/packages/client/src/ShellApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,10 @@ export const ShellApi: React.FC = () => {

function getLgTemplates({ id }, event) {
if (isEventSourceValid(event) === false) return false;

if (id === undefined) throw new Error('must have a file id');
const file = lgFiles.find(file => file.id === id);
if (!file) throw new Error(`lg file ${id} not found`);
return lgUtil.parse(file.content).map(template => {
const { name, parameters, body } = template;
return {
name,
parameters,
body,
};
});
return file.templates;
}

/**
Expand Down

0 comments on commit a8f9015

Please sign in to comment.