From 6ed5309b4fa80db6ce115f3bfe3ee29f34bd3eb6 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 20 Mar 2023 11:00:15 +0000 Subject: [PATCH] fix: check for login on checkout --- .../customer-stall/customer-stall.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/static/components/customer-stall/customer-stall.js b/static/components/customer-stall/customer-stall.js index 2f933e0..2f21262 100644 --- a/static/components/customer-stall/customer-stall.js +++ b/static/components/customer-stall/customer-stall.js @@ -182,8 +182,14 @@ async function customerStall(path) { this.checkoutDialog.data.pubkey = this.customerPubkey this.checkoutDialog.data.privkey = this.customerPrivkey }, + checkLogIn() { + this.customerPubkey = this.account?.pubkey + this.customerPrivkey = this.account?.privkey + this.customerUseExtension = this.account?.useExtension + }, openCheckout() { // Check if user is logged in + this.checkLogIn() if (this.customerPubkey) { this.checkoutDialog.data.pubkey = this.customerPubkey if (this.customerPrivkey && !this.useExtension) { @@ -337,12 +343,12 @@ async function customerStall(path) { let json = JSON.parse(text) if (json.id != this.activeOrder) return - if (json.payment_options.length == 0 && json.message) { - this.loading = false - this.qrCodeDialog.data.message = json.message - return cb() - } if (json.payment_options) { + if (json.payment_options.length == 0 && json.message) { + this.loading = false + this.qrCodeDialog.data.message = json.message + return cb() + } let payment_request = json.payment_options.find(o => o.type == 'ln') .link if (!payment_request) return @@ -367,9 +373,7 @@ async function customerStall(path) { } }, created() { - this.customerPubkey = this.account?.pubkey - this.customerPrivkey = this.account?.privkey - this.customerUseExtension = this.account?.useExtension + this.checkLogIn() let storedCart = this.$q.localStorage.getItem( `diagonAlley.carts.${this.stall.id}` )