Created
July 17, 2020 21:12
-
-
Save isaidspaghetti/330e5a38b7e6bf518b19e8a57e914b47 to your computer and use it in GitHub Desktop.
handle form submit stream registration
This file contains 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
//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