⚡ Put geo location fetch in try/catch
This commit is contained in:
parent
cf2bddf130
commit
782c64a683
|
@ -121,9 +121,15 @@
|
|||
},
|
||||
|
||||
async created () {
|
||||
const ipResponse = await fetch(IPDATA_URL)
|
||||
const ipData = ipResponse.json()
|
||||
this.userCountry = ipData.country_code
|
||||
try {
|
||||
const ipResponse = await fetch(IPDATA_URL)
|
||||
const ipData = ipResponse.json()
|
||||
if (ipData.country_code) {
|
||||
this.userCountry = ipData.country_code
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Unable to fetch geo location:', error)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
@ -55,8 +55,6 @@ export function getTranslatedAliases (data, section) {
|
|||
)]
|
||||
}
|
||||
|
||||
console.log('getTranslatedAliases inside', getTranslatedAliases)
|
||||
|
||||
export function getTranslatedUrl (section, prefixUrl, omitLocale = false) {
|
||||
const messages = i18n.messages[getCurrentLocale()][section]
|
||||
const url = messages.url
|
||||
|
|
Loading…
Reference in a new issue