Skip to content

Commit

Permalink
fix newsletter typo
Browse files Browse the repository at this point in the history
  • Loading branch information
timlrx committed Jul 17, 2023
1 parent bfb4448 commit 7f71035
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-carpets-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pliny': patch
---

Fix newsletter typo
14 changes: 6 additions & 8 deletions packages/pliny/src/newsletter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function NewsletterAPIHandler(
if (response.status >= 400) {
res.status(response.status).json({ error: `There was an error subscribing to the list.` })
}
res.status(201).json({ error: '' })
res.status(201).json({ message: 'Successfully subscribed to the newsletter' })
} catch (error) {
res.status(500).json({ error: error.message || error.toString() })
}
Expand Down Expand Up @@ -89,18 +89,16 @@ async function NewsletterRouteHandler(req: NextRequest, options: NewsletterConfi
default:
return NextResponse.json({ error: `${options.provider} not supported` }, { status: 500 })
}
if (response.status == 200) {
return NextResponse.json(
{ message: 'Successfully subscribed to the newsletter' },
{ status: response.status }
)
} else if (response.status >= 400) {
if (response.status >= 400) {
return NextResponse.json(
{ error: `There was an error subscribing to the list` },
{ status: response.status }
)
}
return NextResponse.json({ error: '' }, { status: 201 })
return NextResponse.json(
{ message: 'Successfully subscribed to the newsletter' },
{ status: 201 }
)
} catch (error) {
return NextResponse.json({ error: error.message || error.toString() }, { status: 500 })
}
Expand Down
1 change: 0 additions & 1 deletion packages/pliny/src/ui/NewsletterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const NewsletterForm = ({
inputEl.current.value = ''
setError(false)
setSubscribed(true)
setMessage('Successfully! 🎉 You are now subscribed.')
}

return (
Expand Down

0 comments on commit 7f71035

Please sign in to comment.