Skip to content

Commit

Permalink
clean up again
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Aug 29, 2023
1 parent 6191265 commit 0fe2f44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
4 changes: 0 additions & 4 deletions netlify/functions/thumbnail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ export const handler: Handler = (event, context, callback) => {
return;
}
const img = result.thumbnail;
// const base64Image = img.split(';base64,').pop();
callback!(null, {
statusCode: 200,
body: img,
// headers: {'Content-Type': 'image/png'},
// body: base64Image,
// isBase64Encoded: true,
});
connection.close();
});
Expand Down
30 changes: 14 additions & 16 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,18 @@ export function getTemplateInstance(
templateName: string,
templateInstance: string,
): Promise<TemplateInstance> {
return (
simpleGetJSON(
`.netlify/functions/template-instance/${templateAuthor}/${templateName}/${templateInstance}`,
)
.then((x) => {
x.template_instance =
x.template_instance && typeof x.template_instance === 'string'
? JSON.parse(x.template_instance)
: x.template_instance;
return x;
})
.catch((e) => {
console.error(e);
return {} as TemplateInstance;
})
);
return simpleGetJSON(
`.netlify/functions/template-instance/${templateAuthor}/${templateName}/${templateInstance}`,
)
.then((x) => {
x.template_instance =
x.template_instance && typeof x.template_instance === 'string'
? JSON.parse(x.template_instance)
: x.template_instance;
return x;
})
.catch((e) => {
console.error(e);
return {} as TemplateInstance;
});
}

0 comments on commit 0fe2f44

Please sign in to comment.