vue-tel-input icon indicating copy to clipboard operation
vue-tel-input copied to clipboard

ip2c fetch call sometimes fails and is unreliable

Open Gabcot opened this issue 2 years ago • 5 comments

We noticed recently that the ip2c fetch call is very slow (4-5s) and can even timeout. This leads to the flag widget remaining blank and not working properly. The slow call prevents the widget from initializing correctly

Having an option to set a shorter timeout, cancelling the request when numbers are inputed or setting a default flag if the call is failing would be ideal.

Gabcot avatar Apr 20 '22 15:04 Gabcot

@Gabcot i have the same issue and a lot of issue are open because of that... Is there a good alternative?

dominikager avatar Apr 20 '22 16:04 dominikager

@dominikager We are considering creating our own ip detection on the frontend and feed the country ISO2 as a default value to override the ip2c call.

Gabcot avatar Apr 20 '22 16:04 Gabcot

@Gabcot i added the following lines and it works

 mounted() {
    axios.get('http://ip-api.com/json/?fields=status,message,countryCode').then(function (payload) {
      this.defaultCountry = payload.data.countryCode
    })
  },
<vue-tel-input
  :auto-default-country="false"
  :default-country="defaultCountry"
  />

dominikager avatar Apr 20 '22 18:04 dominikager

@dominikager Thanks!, the answer worked for me, Only that I set default-country as a static value for my requirements. <vue-tel-input :auto-default-country="false" default-country="MX" />

Kegara avatar May 19 '22 21:05 Kegara

it cant be changed after it mounted..

F-y-o-d-o-r avatar Aug 05 '22 07:08 F-y-o-d-o-r