Skip to content

Instantly share code, notes, and snippets.

@abediali
Created October 17, 2023 18:11
Show Gist options
  • Save abediali/99c52fbc095fc9860fc88c3c0fb87c58 to your computer and use it in GitHub Desktop.
Save abediali/99c52fbc095fc9860fc88c3c0fb87c58 to your computer and use it in GitHub Desktop.
params = {
email: data.email,
"list_id": xxxx,
"first_name": data.firstName,
"last_name": data.lastName,
"$source": source[type],
"$fields": '$consent,$source',
"$consent": "web",
}
const urlData = new URLSearchParams(params)
fetch(`https://manage.kmail-lists.com/ajax/subscriptions/subscribe`, {
method: 'POST',
body: urlData,
})
.then(async response => {
setSuccess(true)
})
.catch(error => {
setError('root', {
type: 'submit',
error.message,
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment