From cc15e46874b9322a808068e8b212252528b3d02b Mon Sep 17 00:00:00 2001 From: marsteralex Date: Mon, 15 Aug 2022 20:42:05 -0400 Subject: [PATCH] only load set data if needed --- web/public/mtg/app.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/public/mtg/app.js b/web/public/mtg/app.js index 182d323f..b7358a49 100644 --- a/web/public/mtg/app.js +++ b/web/public/mtg/app.js @@ -20,10 +20,6 @@ flag = true page = 1 sets = {} -fetch('jsons/set.json') - .then((response) => response.json()) - .then((data) => (sets = data)) - window.console.log(sets) document.location.search.split('&').forEach((pair) => { let v = pair.split('=') @@ -38,6 +34,12 @@ document.location.search.split('&').forEach((pair) => { } }) +if (whichGuesser === 'basic') { + fetch('jsons/set.json') + .then((response) => response.json()) + .then((data) => (sets = data)) +} + let firstFetch = fetch('jsons/' + whichGuesser + '.json') fetchToResponse(firstFetch)