From 5c3e2b89b82a81dd86d32f3f8c4ea22e5bbc5f94 Mon Sep 17 00:00:00 2001 From: Jaroslav Drzik Date: Sat, 20 Jan 2024 22:40:38 +0100 Subject: [PATCH] Bug in tproducts --- resources/js/Pages/IkeaRoot.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 4735222..868b940 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -56,7 +56,8 @@ const gchartEvents = ref({ const tproducts = computed(() => { console.log('PR=', products); console.log('CC=', countryCurrency.value); - return products.value.map((prod) => { + return products.value.map((p) => { + const prod = { ...p }; prod.currency = countryCurrency.value[prod.countryName]; if (currencyHash.value[prod.currency]) prod.calcPrice = prod.salesPrice / currencyHash.value[prod.currency]; else { @@ -245,8 +246,8 @@ const fetch_rates = async () => { const fetch_ccodes = async () => { try { - // const response2 = await axios.get(route('geo.ip.get')); - // geoip.value = response2.data; + const response2 = await axios.get(route('geo.ip.get')); + geoip.value = response2.data; const response = await axios.get(route('ccountry.codes')) ccodes.value = response.data; @@ -354,12 +355,12 @@ const submit = () => { form.post(route('products.compare')); }; -// watch(ccodes, (codes) => { -// console.log('NNN=',codes); -// console.log('IP=',geoip.value); -// codes.forEach((c) => { if (c.code == geoip.value.iso_code) form.country = c; }); -// console.log(form.country); -// }) +watch(ccodes, (codes) => { + console.log('NNN=',codes); + console.log('IP=',geoip.value); + codes.forEach((c) => { if (c.code == geoip.value.iso_code) form.country = c; }); + console.log(form.country); +})