Skip to content

Instantly share code, notes, and snippets.

@tudorilisoi
Created May 26, 2020 20:06
Show Gist options
  • Save tudorilisoi/b10d20cf5fe8b6788188c2f247b8c2de to your computer and use it in GitHub Desktop.
Save tudorilisoi/b10d20cf5fe8b6788188c2f247b8c2de to your computer and use it in GitHub Desktop.
fetch('/api/recipe').then(res => {
const data = res.json()
//do smthng with react
return data
})
.then(parsedJSON => {
fetch(`/api/recipes/${data.id}`)
})
.catch(e => {
})
const p = Promise.resolve(42)
// p.then(actualValue=>{})
async function chain2P() {
try {
x = 32
const res = await fetch('/api/recipe')
const parsedData = res.json()
const extData = await fetch(`/api/recipes/${parsedData.id}`)
const parsedExtData = res.json()
} catch (error) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment