Created
February 14, 2023 14:04
-
-
Save Gr8Gatsby/53f0b95280fecfd32dc11f22216e2fff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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