Last active
February 1, 2019 18:32
-
-
Save kellymears/f8ae392fa9fc53314c8cf86e931ca9cc to your computer and use it in GitHub Desktop.
axios actionNetwork example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let actionNetwork = { | |
config: { | |
headers: { | |
'Content-Type': 'application/json' | |
} | |
}, | |
endpoint: 'https://www.actionnetwork.org/api/v2/forms/72312f19-8071-4fed-8bb5-8befefb9cc77/submissions', | |
data: { | |
'person': { | |
'postal_addresses': [{ | |
'postal_code': activist.postalCode | |
}], | |
'email_addresses': [{ | |
'address': activist.email | |
}] | |
} | |
} | |
} | |
axios.post(actionNetwork.endpoint, actionNetwork.data, actionNetwork.config) | |
.then(response => { | |
dispatch(advocacySuccess(response)) | |
}) | |
.catch(function(err) { | |
dispatch(advocacyError(err)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment