Skip to content

Instantly share code, notes, and snippets.

@oddevan
Created November 2, 2020 22:10
Show Gist options
  • Save oddevan/f99f31381e2d4c46261908f9058a5788 to your computer and use it in GitHub Desktop.
Save oddevan/f99f31381e2d4c46261908f9058a5788 to your computer and use it in GitHub Desktop.
async function fetchAndSetResponse(url, setAttributes) {
const oEmbedUrl = `oddevan/v1/devArtProxy?url=${encodeURIComponent(url)}`;
try {
const response = await apiFetch({ path: oEmbedUrl });
setAttributes({ embedData: response });
} catch(e) {
console.log('Error in DA block', { url: oEmbedUrl, error: e });
setAttributes({ embedData: {} });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment