-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround undefined errors property on IResult
- Loading branch information
1 parent
ac2b909
commit 75d3ba7
Showing
1 changed file
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import { sendSimpleMail, IResult } from 'https://deno.land/x/[email protected]/mod.ts'; | ||
import { sendSimpleMail } from 'https://deno.land/x/[email protected]/mod.ts'; | ||
|
||
type Result = { | ||
success: boolean, | ||
errors: string[] | ||
} | ||
|
||
/** | ||
* Uses the SendGrid API to send an email. | ||
|
@@ -10,7 +15,7 @@ import { sendSimpleMail, IResult } from 'https://deno.land/x/[email protected]/mod. | |
* @param html The HTML content of the email | ||
* @returns Success or errors | ||
*/ | ||
export async function send(subject: string, to: string, from: string, plain: string, html: string ): Promise<IResult> { | ||
export async function send(subject: string, to: string, from: string, plain: string, html: string ): Promise<Result> { | ||
const API_KEY = Deno.env.get("SENDGRID_API_KEY"); | ||
|
||
if(! API_KEY) { | ||
|
@@ -32,5 +37,8 @@ export async function send(subject: string, to: string, from: string, plain: str | |
}, | ||
); | ||
|
||
return response; | ||
return { | ||
success: response.success, | ||
errors: response.errors ?? [] | ||
}; | ||
} |