Skip to content

Instantly share code, notes, and snippets.

@carlrip
Created July 26, 2019 18:09
Show Gist options
  • Save carlrip/9877246cb670552988d3b120634ecad6 to your computer and use it in GitHub Desktop.
Save carlrip/9877246cb670552988d3b120634ecad6 to your computer and use it in GitHub Desktop.
type LogDataOptions = {
skip?: boolean;
path?: string;
};
async function logData({
skip = false,
path = "https://swapi.co/api/people/1"
}: LogDataOptions) {
if (!skip) {
const response = await fetch(path);
const data = await response.json();
console.log(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment