From 0de0fda98dc35bd6503f1a45a52878b154a94c75 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 23 Feb 2023 10:52:40 +0700 Subject: fox --- src/pages/api/activation-request.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/pages/api/activation-request.js (limited to 'src/pages/api') diff --git a/src/pages/api/activation-request.js b/src/pages/api/activation-request.js new file mode 100644 index 00000000..7fae2fd1 --- /dev/null +++ b/src/pages/api/activation-request.js @@ -0,0 +1,27 @@ +import odooApi from '@/core/api/odooApi' +import mailer from '@/core/utils/mailer' + +export default async function handler(req, res) { + try { + const { email } = req.body + let result = await odooApi('POST', '/api/v1/user/activation-request', { email }) + if (result.activationRequest) { + mailer.sendMail({ + from: 'sales@indoteknik.com', + to: result.user.email, + subject: 'Permintaan Aktivasi Akun Indoteknik', + html: ` +

Permintaan Aktivasi Akun Indoteknik

+
+

Aktivasi akun anda melalui link berikut: Aktivasi Akun

+ ` + }) + } + delete result.user + delete result.token + res.status(200).json(result) + } catch (error) { + console.log(error) + res.status(400).json({ error: error.message }) + } +} -- cgit v1.2.3