(pathname)
| 5 | const BASE_URL = `https://api.quotable.io`; |
| 6 | |
| 7 | const fetchQuote = async (pathname) => { |
| 8 | fetch(`${BASE_URL}/${pathname}`) |
| 9 | .then((res) => res.json()) |
| 10 | .then((data) => { |
| 11 | // console.log(data); |
| 12 | quote.textContent = data.content; |
| 13 | author.textContent = `_${data.author}`; |
| 14 | nextQuote.id = `${data._id}`; |
| 15 | }); |
| 16 | }; |
| 17 | |
| 18 | nextQuote.addEventListener("click", () => { |
| 19 | fetchQuote(`random`); |