Skip to content

Instantly share code, notes, and snippets.

@Gr8Gatsby
Created February 14, 2023 14:04
Show Gist options
  • Save Gr8Gatsby/53f0b95280fecfd32dc11f22216e2fff to your computer and use it in GitHub Desktop.
Save Gr8Gatsby/53f0b95280fecfd32dc11f22216e2fff to your computer and use it in GitHub Desktop.
Rapid.onResponse(async (res) => {
const main = document.querySelector("main");
if (!res) {
main.innerHTML = "<pre>Response is empty</pre>";
return;
}
const data = await res.json();
main.innerHTML =
`<div> ${data.results[0].name.first} ${data.results[0].name.last} </div>
<img src="${data.results[0].picture.medium}"/>
`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment