Fix Geoip controller

This commit is contained in:
2024-01-20 20:49:28 +01:00
parent d0208384ad
commit c3857fce68
2 changed files with 6 additions and 3 deletions

View File

@@ -245,12 +245,14 @@ const fetch_rates = async () => {
const fetch_ccodes = async () => {
try {
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;
ccodes.value = Object.entries(ccodes.value).map(([k, v]) => { if (v !== null) return { "country": k, "code": v } }).filter(n => n);
console.log("ccodes=", ccodes.value);
const response2 = await axios.get(route('geo.ip.get'));
geoip.value = response2.data;
} catch (e) {
const response = await Swal.fire({
title: __('are you want to try again') + '?',
@@ -354,6 +356,7 @@ const submit = () => {
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);
})