Files
cadhub/web/src/helpers/subscribe.js
Kurt Hutten d3d73ca475 issue-129 Update signin/up ui-ux
Getting rid of the netlify widgit and rolling our own, gives us the
flexibility to also add the username into the signup process as well
as allow the user to opt into the newsletter at the same time.

Auth is still netlify, via their "gotrue", we're just handling the more
of it.
2020-12-05 18:20:07 +11:00

16 lines
517 B
JavaScript

export const subscribe = ({ email, addMessage }) => {
// subscribe to mailchimp newsletter
const path = window.location.hostname + window.location.pathname
try {
fetch(
`https://kurthutten.us10.list-manage.com/subscribe/post-json?u=cbd8888e924bdd99d06c14fa5&id=6a765a8b3d&EMAIL=${email}&FNAME=Kurt&PATHNAME=${path}&c=__jp0`
)
} catch (e) {
setTimeout(() => {
addMessage('Problem subscribing to newsletter', {
classes: 'bg-red-300 text-red-900',
})
}, 1000)
}
}