Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. handleSubmit(e) {
  2. console.log(process.env);
  3. console.log(hostname);
  4. fetch(hostname + '/api/create', {
  5. method: 'POST',
  6. headers: {
  7. 'Accept': 'application/json',
  8. 'Content-Type': 'application/json'
  9. },
  10. body: JSON.stringify({
  11. date: "outside of time",
  12. original_url: this.state.value
  13. })
  14. }).then((response) => response.json().then(data => {
  15. console.log(data);
  16.  
  17. //change route to url_id from response
  18. window.location.pathname = data.id;
  19. })
  20. ).catch(error=>{
  21. console.log(error);
  22. });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement