Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function onTemplateChosen() {
console.log('Template chosen');
// Read template
const template = await readFileIntoArrayBuffer(this.files[0]);
// Create report
console.log('Creating report (can take some time) ...');
const report = await createReport({
template,
data: async query => {
const finalQuery = query || '{ viewer { login }}';
const resp = await fetch('/github', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: finalQuery }),
});
const js = await resp.json();
console.log(js);
return js;
},
additionalJsContext: {
tile: async (z, x, y) => {
const resp = await fetch(
`http://tile.stamen.com/toner/${z}/${x}/${y}.png`