Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip2c fetch call sometimes fails and is unreliable #342

Open
Gabcot opened this issue Apr 20, 2022 · 5 comments
Open

ip2c fetch call sometimes fails and is unreliable #342

Gabcot opened this issue Apr 20, 2022 · 5 comments

Comments

@Gabcot
Copy link

Gabcot commented Apr 20, 2022

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.

@dominikager
Copy link

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

@Gabcot
Copy link
Author

Gabcot commented Apr 20, 2022

@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.

@dominikager
Copy link

@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"
  />

@Kegara
Copy link

Kegara commented May 19, 2022

@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" />

@F-y-o-d-o-r
Copy link

it cant be changed after it mounted..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants