fix: working convertkit API

This commit is contained in:
Gautier Arcin 2021-09-09 10:18:57 +02:00
parent 3de2733c49
commit 8b1b0c20bb
3 changed files with 5 additions and 12 deletions

View File

@ -15,5 +15,4 @@ BUTTONDOWN_API_KEY=
CONVERTKIT_API_URL=https://api.convertkit.com/v3/
CONVERTKIT_API_KEY=
CONVERTKIT_TIPS_FORM_ID=
CONVERTKIT_MONTHLY_FORM_ID=
CONVERTKIT_FORM_ID=

View File

@ -25,7 +25,7 @@ const siteMetadata = {
newsletter: {
// supports mailchimp, buttondown, convertkit
// Please add your .env file and modify it according to your selection
provider: 'mailchimp',
provider: 'convertkit',
},
comment: {
// Select a provider and use the environment variables associated to it

View File

@ -1,20 +1,14 @@
/* eslint-disable import/no-anonymous-default-export */
export default async (req, res) => {
const { email, list } = req.query
const { email } = req.body
console.log('email : ', email)
if (!email) {
return res.status(400).json({ error: 'Email is required' })
}
if (!list) {
return res.status(400).json({ error: 'List is required' })
}
try {
const FORM_ID =
list === '12-tips-production-apps'
? process.env.CONVERTKIT_TIPS_FORM_ID
: process.env.CONVERTKIT_MONTHLY_FORM_ID
const FORM_ID = process.env.CONVERTKIT_FORM_ID
const API_KEY = process.env.CONVERTKIT_API_KEY
const API_URL = process.env.CONVERTKIT_API_URL