Skip to content

Commit 8b1b0c2

Browse files
committed
fix: working convertkit API
1 parent 3de2733 commit 8b1b0c2

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

.env.example

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ BUTTONDOWN_API_KEY=
1515

1616
CONVERTKIT_API_URL=https://api.convertkit.com/v3/
1717
CONVERTKIT_API_KEY=
18-
CONVERTKIT_TIPS_FORM_ID=
19-
CONVERTKIT_MONTHLY_FORM_ID=
18+
CONVERTKIT_FORM_ID=

data/siteMetadata.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const siteMetadata = {
2525
newsletter: {
2626
// supports mailchimp, buttondown, convertkit
2727
// Please add your .env file and modify it according to your selection
28-
provider: 'mailchimp',
28+
provider: 'convertkit',
2929
},
3030
comment: {
3131
// Select a provider and use the environment variables associated to it

pages/api/convertkit.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
/* eslint-disable import/no-anonymous-default-export */
22
export default async (req, res) => {
3-
const { email, list } = req.query
3+
const { email } = req.body
4+
console.log('email : ', email)
45

56
if (!email) {
67
return res.status(400).json({ error: 'Email is required' })
78
}
89

9-
if (!list) {
10-
return res.status(400).json({ error: 'List is required' })
11-
}
12-
1310
try {
14-
const FORM_ID =
15-
list === '12-tips-production-apps'
16-
? process.env.CONVERTKIT_TIPS_FORM_ID
17-
: process.env.CONVERTKIT_MONTHLY_FORM_ID
11+
const FORM_ID = process.env.CONVERTKIT_FORM_ID
1812
const API_KEY = process.env.CONVERTKIT_API_KEY
1913
const API_URL = process.env.CONVERTKIT_API_URL
2014

0 commit comments

Comments
 (0)