aboutsummaryrefslogtreecommitdiffstats
path: root/routes/email.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/email.js')
-rw-r--r--routes/email.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/routes/email.js b/routes/email.js
index 9213cdd3..1b551864 100644
--- a/routes/email.js
+++ b/routes/email.js
@@ -6,16 +6,16 @@ import sendgrid from "@sendgrid/mail";
export default {
async send({ body }, res) {
let { token: response } = body;
- let { recaptcha: secret } = config;
- let { success } = await got
+ let { recaptcha: secret } = config;
+ let { success } = await got
.post("https://www.google.com/recaptcha/api/siteverify", {
form: {
secret,
- response
- }
+ response,
+ },
})
.json();
-
+
if (success) {
delete body.token;
sendgrid.setApiKey(config.sendgrid);
@@ -24,15 +24,13 @@ export default {
subject: body.subject || "Email Signup",
text: JSON.stringify(body),
- html: JSON.stringify(body)
+ html: JSON.stringify(body),
};
- await sendgrid.send(msg);
- res.send({ ok: true });
-
- }
- else {
- bail(res, "failed captcha");
- }
- }
+ await sendgrid.send(msg);
+ res.send({ ok: true });
+ } else {
+ bail(res, "failed captcha");
+ }
+ },
};