Open mozenkov opened 2 years ago
Hi! If you want to go directly to the created post, you need to do the next thing: Привiт! Якщо ви хочете відразу перейти в щойно створений пост, вам потрібно зробити наступне:
fetch('http://localhost:8000/blogs',{ method: 'POST', headers:{"Content-Type":"application/json"}, body: JSON.stringify(blog) }) .then(response =>{return response}) .then(response => response.json()) .then((response) => history.push('/blogs/' + response.id))
Hi! If you want to go directly to the created post, you need to do the next thing: Привiт! Якщо ви хочете відразу перейти в щойно створений пост, вам потрібно зробити наступне:
fetch('http://localhost:8000/blogs',{ method: 'POST', headers:{"Content-Type":"application/json"}, body: JSON.stringify(blog) }) .then(response =>{return response}) .then(response => response.json()) .then((response) => history.push('/blogs/' + response.id))