Lint changes

This commit is contained in:
Francis 2021-12-06 09:36:34 -05:00 committed by GitHub
parent d059a564e5
commit 795d596012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,9 @@ export default async (req, res) => {
try {
const API_KEY = process.env.KLAVIYO_API_KEY
const LIST_ID = process.env.KLAVIYO_LIST_ID
const response = await fetch(`https://a.klaviyo.com/api/v2/list/${LIST_ID}/subscribe?api_key=${API_KEY}`, {
const response = await fetch(
`https://a.klaviyo.com/api/v2/list/${LIST_ID}/subscribe?api_key=${API_KEY}`,
{
method: 'POST',
headers: {
Accept: 'application/json',
@ -16,11 +18,10 @@ export default async (req, res) => {
// You can add additional params here i.e. SMS, etc.
// https://developers.klaviyo.com/en/reference/subscribe
body: JSON.stringify({
profiles: [
{email: email},
]
profiles: [{ email: email }],
}),
})
}
)
if (response.status >= 400) {
return res.status(400).json({
error: `There was an error subscribing to the list.`,