Skip to content

Commit

Permalink
Merge pull request #273 from zimmerman-team/feat/DX-2107
Browse files Browse the repository at this point in the history
feat: DX-2107 - Connect Newsletter subscription to intercom
  • Loading branch information
Psami-wondah authored Dec 10, 2024
2 parents c46a07e + aefcab4 commit d9c98d0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/app/modules/common/newsletterForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,9 @@ export default function NewsletterForm(
props.setIsSubscriptionFailed(false);
axios
.post(
`https://api.hsforms.com/submissions/v3/integration/submit/${process.env.REACT_APP_HUBSPOT_PORTAL_ID}/${process.env.REACT_APP_HUBSPOT_SUBSCRIBE_FORM_ID}`,
`${process.env.REACT_APP_API}/users/subscribe-to-newsletter`,
{
portalId: process.env.REACT_APP_HUBSPOT_PORTAL_ID,
formGuid: process.env.REACT_APP_HUBSPOT_SUBSCRIBE_FORM_ID,
fields: [
{
name: "email",
value: formValues.email,
},
],
email: formValues.email,
},
{
headers: {
Expand All @@ -68,6 +61,9 @@ export default function NewsletterForm(
)
.then((response: AxiosResponse) => {
if (response.status === 200) {
if (response.data.error) {
return props.setIsSubscriptionFailed(true);
}
setValue("email", "");
setPlaceholder(emailAddress);
props.setIsSubscribed(true);
Expand Down

0 comments on commit d9c98d0

Please sign in to comment.