Skip to content

Commit 3c63c5d

Browse files
committed
Merge branch 'fix/use-frontend-ip-lookup' of github.com:fleetbase/ember-ui into fix/use-frontend-ip-lookup
2 parents 7b06d59 + 50d6ffb commit 3c63c5d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

addon/components/phone-input.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ export default class PhoneInputComponent extends Component {
1616
initialCountry: 'auto',
1717
separateDialCode: true,
1818
formatAsYouType: true,
19-
geoIpLookup: async (success, failure) => {
19+
geoIpLookup: async (success) => {
2020
try {
2121
const ipData = await lookupUserIp();
2222
if (ipData && ipData.country_code) {
2323
success(ipData.country_code);
2424
} else {
25-
throw new Error('No country code in IP lookup response');
25+
// Fallback to US if no country code in response
26+
debug('No country code in IP lookup response, defaulting to US');
27+
success('us');
2628
}
2729
} catch (error) {
28-
debug('Failed to lookup country code with frontend IP lookup:', error.message);
29-
failure(error);
30+
// Always succeed with US fallback on error
31+
debug('Failed to lookup country code, defaulting to US: ' + error.message);
32+
success('us');
3033
}
3134
},
3235
utilsScript: '/assets/libphonenumber/utils.js',

0 commit comments

Comments
 (0)