From 929623949bdccfbd20e3bacf0c41da8942d5141f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 9 Sep 2024 22:19:05 +0200 Subject: [PATCH] perf: change code position(clean code) --- src/pages/Ecomerce/BasketView.vue | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pages/Ecomerce/BasketView.vue b/src/pages/Ecomerce/BasketView.vue index 7d996ee0..04a2ef6c 100644 --- a/src/pages/Ecomerce/BasketView.vue +++ b/src/pages/Ecomerce/BasketView.vue @@ -17,6 +17,14 @@ const rows = ref([]); const ticket = ref({}); const orderId = ref(null); +onBeforeMount(() => { + appStore.check(); +}); + +onMounted(async () => { + orderId.value = route.params.id || basketOrderId.value; + if (orderId.value) await fetchData(); +}); const getOrder = async () => { try { const [data] = await jApi.query( @@ -88,15 +96,6 @@ const fetchData = async () => { await getItems(); await getOrder(); }; - -onBeforeMount(() => { - appStore.check(); -}); - -onMounted(async () => { - orderId.value = route.params.id || basketOrderId.value; - await fetchData(); -});