From 4fe072f19ea8f9cd6295a052c60dbfa98be904a5 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 27 Jan 2024 08:27:52 -0700 Subject: [PATCH] move DB logic out of 'created' in components since it's not needed yet --- src/components/GiftedDialog.vue | 34 ++++++++++++++++----------------- src/components/OfferDialog.vue | 4 +--- src/views/HomeView.vue | 4 ++-- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index f18f54d..9dda5d9 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -109,7 +109,22 @@ export default class GiftedDialog extends Vue { libsUtil = libsUtil; - async created() { + async open(giver?: GiverInputInfo, offerId?: string) { + this.description = ""; + this.giver = giver || {}; + if (!this.giver.name) { + this.giver.name = didInfo( + this.giver.did, + this.activeDid, + this.allMyDids, + this.allContacts, + ); + } + // if we show "given to user" selection, default checkbox to true + this.givenToUser = this.showGivenToUser; + this.amountInput = "0"; + this.offerId = offerId || ""; + try { await db.open(); const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings; @@ -135,23 +150,6 @@ export default class GiftedDialog extends Vue { -1, ); } - } - - open(giver?: GiverInputInfo, offerId?: string) { - this.description = ""; - this.giver = giver || {}; - if (!this.giver.name) { - this.giver.name = didInfo( - this.giver.did, - this.activeDid, - this.allMyDids, - this.allContacts, - ); - } - // if we show "given to user" selection, default checkbox to true - this.givenToUser = this.showGivenToUser; - this.amountInput = "0"; - this.offerId = offerId || ""; this.visible = true; } diff --git a/src/components/OfferDialog.vue b/src/components/OfferDialog.vue index e163cfc..d552c6c 100644 --- a/src/components/OfferDialog.vue +++ b/src/components/OfferDialog.vue @@ -99,7 +99,7 @@ export default class OfferDialog extends Vue { libsUtil = libsUtil; - async created() { + async open() { try { await db.open(); const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings; @@ -118,9 +118,7 @@ export default class OfferDialog extends Vue { -1, ); } - } - open() { this.visible = true; } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index d832177..8c3e14e 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -319,7 +319,7 @@ export default class HomeView extends Vue { // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { - console.log("Error retrieving settings and/or feed.", err); + console.log("Error retrieving settings or feed.", err); this.$notify( { group: "alert", @@ -327,7 +327,7 @@ export default class HomeView extends Vue { title: "Error", text: err.userMessage || - "There was an error retrieving your settings and/or the latest activity.", + "There was an error retrieving your settings or the latest activity.", }, -1, );