From 97d1391038725e9783ab0b6a8e3ec5998fd88a8d Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:12:15 +0000 Subject: [PATCH] Use reactive variable --- frontend/src/views/Forms.svelte | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/Forms.svelte b/frontend/src/views/Forms.svelte index 464d93c..ded64e5 100644 --- a/frontend/src/views/Forms.svelte +++ b/frontend/src/views/Forms.svelte @@ -33,7 +33,7 @@ {#if activeFormId !== null}
+ on:click={() => deleteForm(activeFormId)}>Delete {activeFormTitle}
{/if} @@ -79,6 +79,7 @@ let newTitle; let forms = []; let activeFormId = null; + $: activeFormTitle = activeFormId !== null ? forms.find(f => f.form_id === activeFormId).title : 'Unknown'; let inputCreationData = {}; $: windowWidth = 0; @@ -179,10 +180,6 @@ forms = res.data || []; } - function getActiveFormTitle() { - return activeFormId !== null ? forms.find(f => f.form_id === activeFormId).title : 'Unknown'; - } - withLoadingScreen(async () => { setDefaultHeaders(); await loadForms();