Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleSubmit(e) {
- console.log(process.env);
- console.log(hostname);
- fetch(hostname + '/api/create', {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- date: "outside of time",
- original_url: this.state.value
- })
- }).then((response) => response.json().then(data => {
- console.log(data);
- //change route to url_id from response
- window.location.pathname = data.id;
- })
- ).catch(error=>{
- console.log(error);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement