Skip to content

Commit

Permalink
fix: process email
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Oct 25, 2024
1 parent 9070044 commit 4bdbc7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/app/src/components/entry-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,20 @@ export function EntryForm({ onFormSubmit, entry }: EntryFormProps) {
let result;
try {
result = await processEmail(e, email.contents)
console.log("result", result)
} catch (e) {
setProcessedResult({
error: true,
matches: [],
message: `Failed to process email: ${e}`,
})
setIsProcessingEmail(false);
return
}
if (result && result.error) {
setProcessedResult(result)
setIsProcessingEmail(false);
return
}
try {
const slug = "drafts/"+form.getValues("slug");
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/lib/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function extractMatches(headerString: string, bodyString: string | undefi
}

export async function extractMatchesWasm(headerString: string, bodyString: string | undefined, values: Values[]) {
let ready = await wasmLoaded;
await wasmLoaded;
let matches: {name: string, match: string}[] = [];
for (const value of values) {
if (value.location == "body" && bodyString) {
Expand Down

0 comments on commit 4bdbc7e

Please sign in to comment.