Created
February 8, 2024 18:55
-
-
Save tperrelli/c969090cd799eddcd7a2be2813a44c8f 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
let uri = 'www.endpoint1.com'; | |
let uri2 = 'www.endpoint1.com/'; | |
let method1 = async() => { | |
let response = await Promise.resolve(fetch(uri)); | |
let items = []; | |
if (response.status === 200) { | |
items = response.data; | |
items = items.map(function(item) { | |
return { | |
id: item.id, | |
name: '' | |
} | |
}); | |
} | |
for (let index of items.keys()) { | |
method2(items[index]); | |
} | |
return items; | |
} | |
const method2 = async(item) => { | |
const resp2 = await Promise.resolve(fetch(uri)); | |
item.name = resp2.name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment