From 1d006283f3397f2e517d1ad2e934646b0b7400c9 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Sun, 19 Jun 2022 03:19:43 -0700 Subject: Remove a console.log in julia, add callback function --- js-scripts/queryJsonPlaceholder.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'js-scripts') diff --git a/js-scripts/queryJsonPlaceholder.js b/js-scripts/queryJsonPlaceholder.js index e8b7ea2..dd6e21e 100644 --- a/js-scripts/queryJsonPlaceholder.js +++ b/js-scripts/queryJsonPlaceholder.js @@ -1,7 +1,12 @@ // Testing to see if I can make API calls on a site that has CSP headers. However, // this certain site does not have those headers on their error page, so by creating -// an iframe on the document root with this source we can make an api call to another +// an iframe on the document root with the error page we can make an api call to another // service, maybe? -fetch('https://jsonplaceholder.typicode.com/todos/1') - .then(response => response.json()) - .then(json => console.log(json)) + +// Old-school callback hell being forced upon me rn +function fetchTodos(callback) { + fetch('https://jsonplaceholder.typicode.com/todos') + .then(response => response.json()) + .then(callback) +} + -- cgit v1.2.3-70-g09d2