From 5ac66481deeeaaf366fb7b04a907a7512ba773cb Mon Sep 17 00:00:00 2001 From: JJtan2002 Date: Tue, 18 Jun 2024 23:12:52 +0800 Subject: [PATCH] Fix updating of monthly summary with async handleTransactions --- frontend/src/pages/Profile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Profile.js b/frontend/src/pages/Profile.js index a8fdb6c..d8ba6bf 100644 --- a/frontend/src/pages/Profile.js +++ b/frontend/src/pages/Profile.js @@ -45,7 +45,7 @@ const Profile = () => { const expenseCategories = ["Food", "Transportation", "Housing", "Utilities", "Entertainment"]; const incomeCategories = ["Salary", "Freelance Income", "Investment", "Gifts", "Other"]; - const handleTransaction = (ev) => { + const handleTransaction = async (ev) => { ev.preventDefault(); const date = new Date(); const isoDateString = date.toISOString(ev.target.date.value); // "YYYY-MM-DD" format for DateField @@ -63,8 +63,8 @@ const Profile = () => { }; console.log(formData); - createTransaction({ transaction: formData }); - refetchWallet(); + await createTransaction({ transaction: formData }); + await refetchWallet(); }