20 lines
633 B
JavaScript
20 lines
633 B
JavaScript
// @ts-check
|
|
async function subscribe(req, res) {
|
|
const { email } = req.body || {};
|
|
if (!email || !/.+@.+\..+/.test(email)) {
|
|
return res.status(400).json({ message: 'Email non valida' });
|
|
}
|
|
// Integra qui Mailchimp/Sendinblue se necessario
|
|
return res.status(200).json({ ok: true });
|
|
}
|
|
|
|
async function unsubscribe(req, res) {
|
|
const { email } = req.body || {};
|
|
if (!email || !/.+@.+\..+/.test(email)) {
|
|
return res.status(400).json({ message: 'Email non valida' });
|
|
}
|
|
// Integra qui Mailchimp/Sendinblue se necessario
|
|
return res.status(200).json({ ok: true });
|
|
}
|
|
|
|
module.exports = { subscribe, unsubscribe }; |