aboutsummaryrefslogtreecommitdiffstats
path: root/pages/api/verify.js
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/verify.js')
-rw-r--r--pages/api/verify.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/pages/api/verify.js b/pages/api/verify.js
index 1606dbc..bdad434 100644
--- a/pages/api/verify.js
+++ b/pages/api/verify.js
@@ -1,7 +1,7 @@
-import withSession from 'lib/withSession'
-import dbConnect from 'lib/dbConnect'
-import sendMail from 'lib/sendMail'
+import dbConnect from 'configs/dbConnect'
+import sendMail from 'configs/sendMail'
import User from 'models/User'
+import withSession from 'hocs/withSession'
import {subject, text, html} from 'helpers/email'
export default withSession(async (req, res) => {
@@ -10,13 +10,13 @@ export default withSession(async (req, res) => {
switch (req.method) {
case 'GET':
try {
- const {email} = req.session.get('user')
+ const {email, language: l} = req.session.get('user')
if (!email) { throw new Error('Something went wrong') }
const key = await User.getVerificationKey(email)
if (!key) { throw new Error('Something went wrong') }
- const response = await sendMail(email, subject, text(key), html(key))
+ const response = await sendMail(email, subject(l), text(l, key), html(l, key))
if (!response?.accepted?.length) { throw new Error('Something went wrong') }
res.status(204).send()
@@ -33,7 +33,6 @@ export default withSession(async (req, res) => {
res.status(200).json(user)
}
} catch (error) {
- console.log(error)
res.status(400).send()
}
break