| const CREATE_PIN_URL = "https://jsonplaceholder.typicode.com/posts"; | |
| const app = document.querySelector("#app"); | |
| app.addEventListener("submit", async (e) => { | |
| e.preventDefault(); | |
| try { | |
| const response = await fetch(CREATE_PIN_URL, { | |
| method: "POST", | |
| body: JSON.stringify({ | |
| title: document.querySelector("#title").value, | |
| description: document.querySelector("#description").value, | |
| }), | |
| }); | |
| console.log(response.json()); | |
| } catch (error) { | |
| console.log(error); | |
| } | |
| }); |