Skip to content

Instantly share code, notes, and snippets.

@chrisjensen
Created June 16, 2020 09:02
Show Gist options
  • Save chrisjensen/9adf579c066ad1555d97854cc36a7a29 to your computer and use it in GitHub Desktop.
Save chrisjensen/9adf579c066ad1555d97854cc36a7a29 to your computer and use it in GitHub Desktop.
Load Costumes
async function loadCostumes(props) {
if (get(props, 'global.campaign.mock')) return mockCostumes;
try {
const response = await fetch(url);
if (!response.ok) {
console.error(await response.text());
throw new Error('Could not load. Try refreshing the page');
}
const body = await response.json();
return body.data.costumeVotes;
} catch (error) {
console.error(error);
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment