Immediately return in pages function when sending email through contact form
All checks were successful
release / Publish to Cloudflare Pages (push) Successful in 1m5s
All checks were successful
release / Publish to Cloudflare Pages (push) Successful in 1m5s
This commit is contained in:
@@ -29,13 +29,15 @@ export const onRequest: PagesFunction<Env> = (context) => {
|
|||||||
// Must have some kind of identifiable information for me to actually care about them.
|
// Must have some kind of identifiable information for me to actually care about them.
|
||||||
if ((fullName || email) && message) {
|
if ((fullName || email) && message) {
|
||||||
try {
|
try {
|
||||||
await context.env.SERVICE.sendEmail({
|
context.waitUntil(
|
||||||
fullName,
|
context.env.SERVICE.sendEmail({
|
||||||
organisation,
|
fullName,
|
||||||
email,
|
organisation,
|
||||||
mobile,
|
email,
|
||||||
message,
|
mobile,
|
||||||
});
|
message,
|
||||||
|
})
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return new Response(e);
|
return new Response(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user