From f08f6ca0a9d337efff280d4d1669a41b5d9c31c2 Mon Sep 17 00:00:00 2001 From: piotrruss Date: Thu, 2 Sep 2021 22:28:11 +0200 Subject: finish translations, force maximize --- pages/api/verify.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'pages/api/verify.js') 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 -- cgit v1.2.3