From c466ed0d2d6ec64734cc8c8756db4e3a53f32444 Mon Sep 17 00:00:00 2001 From: Bruno Bernardino Date: Fri, 3 Nov 2023 05:58:07 +0000 Subject: [PATCH] Do not reload page when pressing enter on search/filter Also do not hide loading on login/signup before data is fully loaded. --- public/ts/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/ts/index.ts b/public/ts/index.ts index 9a2fd6a..a0dc23a 100644 --- a/public/ts/index.ts +++ b/public/ts/index.ts @@ -29,6 +29,7 @@ document.addEventListener('app-loaded', async () => { const loginButton = document.getElementById('login-button') as HTMLButtonElement; const signupButton = document.getElementById('signup-button') as HTMLButtonElement; + const expensesFilterForm = document.getElementById('expenses-filter') as HTMLFormElement; const expensesFilterSearchInput = document.getElementById('expenses-filter-search') as HTMLInputElement; const budgetsFilterButton = document.getElementById('budgets-filter-button') as HTMLButtonElement; const addBudgetButton = document.getElementById('add-budget-button') as HTMLButtonElement; @@ -97,8 +98,6 @@ document.addEventListener('app-loaded', async () => { } } - window.app.hideLoading(); - isLoggingInOrSigningUp = false; } @@ -773,6 +772,11 @@ document.addEventListener('app-loaded', async () => { loginForm.addEventListener('submit', login); signupButton.addEventListener('click', signup); + expensesFilterForm.addEventListener('submit', (event) => { + event.preventDefault(); + event.stopPropagation(); + showData(); + }); addExpenseForm.addEventListener('submit', addExpense); addBudgetButton.addEventListener('click', showAddBudgetModal); budgetsFilterButton.addEventListener('click', showBudgetsFilterModal);