From afea19a640d0266c84d8c25fbfff0c27264608f5 Mon Sep 17 00:00:00 2001 From: Michelle Inez Date: Wed, 19 Feb 2025 13:04:48 -0800 Subject: [PATCH 1/3] feat: export button functionality --- src/components/Portfolio/LoanFilterBar.vue | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/components/Portfolio/LoanFilterBar.vue b/src/components/Portfolio/LoanFilterBar.vue index 8f019b5584..e889c1a316 100644 --- a/src/components/Portfolio/LoanFilterBar.vue +++ b/src/components/Portfolio/LoanFilterBar.vue @@ -8,6 +8,8 @@ Export {{ totalLoans }} loans @@ -55,18 +57,45 @@ From 552754335d27815e78cfd048438db6f35a409a5b Mon Sep 17 00:00:00 2001 From: Michelle Inez Date: Wed, 19 Feb 2025 16:12:53 -0800 Subject: [PATCH 2/3] fix: add error for export --- src/components/Portfolio/LoanFilterBar.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Portfolio/LoanFilterBar.vue b/src/components/Portfolio/LoanFilterBar.vue index e889c1a316..e920f740d3 100644 --- a/src/components/Portfolio/LoanFilterBar.vue +++ b/src/components/Portfolio/LoanFilterBar.vue @@ -61,6 +61,7 @@ import { ref, inject } from 'vue'; import { KvSelect, KvTextInput, KvButton } from '@kiva/kv-components'; import logReadQueryError from '#src/util/logReadQueryError'; import userIdQuery from '#src/graphql/query/userId.graphql'; +import logFormatter from '#src/util/logFormatter'; const props = defineProps({ totalLoans: { @@ -83,7 +84,8 @@ const handleExportClick = async () => { const userId = data?.my?.userAccount?.id; if (!userId) { - console.error('No user ID available for export'); + logFormatter('No user ID available for export'); + this.$showTipMsg('There was a problem preparing your loan export.', 'error'); return; } @@ -93,9 +95,10 @@ const handleExportClick = async () => { user_id: userId.toString() }); - window.location.href = `/portfolio/loans/export?${queryParams.toString()}`; + window.location.href = `https://www.kiva.org/portfolio/loans/export?${queryParams.toString()}`; } catch (error) { logReadQueryError(error, 'LoanFilterBar userIdQuery'); + this.$showTipMsg('There was a problem preparing your loan export.', 'error'); } }; From c3064cbbe012fa13642e51a9ac4e7175d5550dfe Mon Sep 17 00:00:00 2001 From: Michelle Inez Date: Fri, 21 Feb 2025 11:48:20 -0800 Subject: [PATCH 3/3] fix: remove error shown in ui and restore url for export --- src/components/Portfolio/LoanFilterBar.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Portfolio/LoanFilterBar.vue b/src/components/Portfolio/LoanFilterBar.vue index e920f740d3..95434d195f 100644 --- a/src/components/Portfolio/LoanFilterBar.vue +++ b/src/components/Portfolio/LoanFilterBar.vue @@ -85,7 +85,6 @@ const handleExportClick = async () => { const userId = data?.my?.userAccount?.id; if (!userId) { logFormatter('No user ID available for export'); - this.$showTipMsg('There was a problem preparing your loan export.', 'error'); return; } @@ -95,10 +94,9 @@ const handleExportClick = async () => { user_id: userId.toString() }); - window.location.href = `https://www.kiva.org/portfolio/loans/export?${queryParams.toString()}`; + window.location.href = `/portfolio/loans/export?${queryParams.toString()}`; } catch (error) { logReadQueryError(error, 'LoanFilterBar userIdQuery'); - this.$showTipMsg('There was a problem preparing your loan export.', 'error'); } };