Skip to content

Instantly share code, notes, and snippets.

@isaidspaghetti
Created July 17, 2020 21:12
Show Gist options
  • Save isaidspaghetti/330e5a38b7e6bf518b19e8a57e914b47 to your computer and use it in GitHub Desktop.
Save isaidspaghetti/330e5a38b7e6bf518b19e8a57e914b47 to your computer and use it in GitHub Desktop.
handle form submit stream registration
//frontend/src/App.js:15
const register = async (e) => {
try {
e.preventDefault();
var response = await fetch('http://localhost:8080/registrations', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstName,
lastName,
email,
}),
});
// ...
} catch (err) {
console.error(err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment