MCPcopy Create free account
hub / github.com/codemistic/Web-Development / fetchQuote

Function fetchQuote

High/app/script.js:7–16  ·  view source on GitHub ↗
(pathname)

Source from the content-addressed store, hash-verified

5const BASE_URL = `https://api.quotable.io`;
6
7const 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
18nextQuote.addEventListener("click", () => {
19 fetchQuote(`random`);

Callers 1

script.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected