diff --git a/src/stores/app.js b/src/stores/app.js index 1bb65cc9..7996e94c 100644 --- a/src/stores/app.js +++ b/src/stores/app.js @@ -97,22 +97,21 @@ export const useAppStore = defineStore('hedera', { await this.checkOrder(this.basketOrderId); return true; } catch (err) { - if (err.exception === 'Vn.Lib.UserError') { - switch (err.code) { - case 'orderConfirmed': - case 'orderNotOwnedByUser': - await this.redirect(); - break; - default: - this.router.push({ - name: 'checkout', - params: { id: this.basketOrderId }, - query: { continue: checkoutContinue } - }); - notify(err.message, 'negative'); - } - return false; - } else throw err; + switch (err.code) { + case 'orderConfirmed': + case 'orderNotOwnedByUser': + this.unloadOrder(); + await this.redirect(); + break; + default: + this.router.push({ + name: 'checkout', + params: { id: this.basketOrderId }, + query: { continue: checkoutContinue } + }); + notify(err.message, 'negative'); + } + return false; } }, @@ -134,6 +133,12 @@ export const useAppStore = defineStore('hedera', { localStorage.setItem('hederaBasket', orderId); notify('orderLoadedIntoBasket', 'positive'); } + }, + + unloadOrder() { + console.log('unloadOrder'); + localStorage.removeItem('hederaBasket'); + this.basketOrderId = null; } }, getters: {