diff --git a/src/pages/Ecomerce/OrdersView.vue b/src/pages/Ecomerce/OrdersView.vue index 34d00318..5285c56f 100644 --- a/src/pages/Ecomerce/OrdersView.vue +++ b/src/pages/Ecomerce/OrdersView.vue @@ -64,16 +64,22 @@ const onConfirmPay = async () => { await tpv.pay(amountToPay.value); }; -watch( +const onUserId = (cb) => watch( () => userStore?.user?.id, async userId => { if (userId) { - await getDebt(userId); + try { + await cb(userId); + } catch (error) { + console.error(error); + } } }, { immediate: true } ); +onUserId(getDebt); +