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(); } }