From f894d80c2218c4057aa3d76012a371628c61245b Mon Sep 17 00:00:00 2001 From: midblep Date: Wed, 25 May 2022 00:25:06 +0200 Subject: [PATCH] quick fix --- src/lib/calculator/Calculator.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/calculator/Calculator.svelte b/src/lib/calculator/Calculator.svelte index 329b30a..e268dd5 100644 --- a/src/lib/calculator/Calculator.svelte +++ b/src/lib/calculator/Calculator.svelte @@ -23,10 +23,12 @@ $: number = commissions.length + 1; async function setup() { + let prefill = true; const urlParams = new URLSearchParams(window.location.search); urlParams.forEach((value, key) => { if(key == "commissions") { try { + prefill = false; commissions = JSON.parse(value); commissions.forEach(value => { types.forEach(element => { @@ -42,12 +44,12 @@ console.log(value.example); }); } catch(msg) { - commissions = []; + prefill = true; error = "The selected preset link failed to load. It may be from an old version of the commission picker. It has been replaced with the default preset below." } } }); - if(commissions.length == 0) { + if(prefill) { base(); } }