🐛 Fixes country code fetching for results
This commit is contained in:
parent
52fc3dde46
commit
201a31e497
|
@ -30,18 +30,16 @@
|
|||
|
||||
<script>
|
||||
import '@/assets/icons/european-stars'
|
||||
import { IPDATA_URL } from '@/config/api'
|
||||
import { GA_COOKIE_NAME } from '@/config/analytics'
|
||||
import { SUPPORTED_LOCALES } from '@/config'
|
||||
import { setCookie, getCookie } from '@/helper/cookies'
|
||||
import { getUserLanguage, getTranslatedUrl } from '@/i18n/helper'
|
||||
import { getTranslatedUrl } from '@/i18n/helper'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
|
||||
data () {
|
||||
return {
|
||||
userCountry: getUserLanguage().country,
|
||||
showConsentLayer: getCookie(GA_COOKIE_NAME) === null,
|
||||
euromatLogo: require('@/assets/svg/euromat-logo.svg'),
|
||||
logoSize: 220,
|
||||
|
@ -120,18 +118,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
async created () {
|
||||
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: {
|
||||
updateConsent (consent) {
|
||||
setCookie(GA_COOKIE_NAME, consent)
|
||||
|
|
|
@ -97,7 +97,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getTranslatedUrl } from '@/i18n/helper'
|
||||
import { IPDATA_URL } from '@/config/api'
|
||||
import { getTranslatedUrl, getUserLanguage } from '@/i18n/helper'
|
||||
import {
|
||||
MAX_POINTS,
|
||||
BASE_POINTS,
|
||||
|
@ -123,7 +124,7 @@
|
|||
|
||||
data () {
|
||||
return {
|
||||
userCountry: this.$root.$children[0].userCountry.toLowerCase(),
|
||||
userCountry: getUserLanguage().country,
|
||||
scoringGrid: [],
|
||||
answers: [],
|
||||
emphasized: [],
|
||||
|
@ -153,7 +154,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
async created () {
|
||||
let emphasized
|
||||
let answers
|
||||
|
||||
|
@ -169,6 +170,16 @@
|
|||
this.$router.push({ path: getTranslatedUrl('theses') })
|
||||
}
|
||||
|
||||
try {
|
||||
const ipResponse = await fetch(IPDATA_URL)
|
||||
const ipData = await ipResponse.json()
|
||||
if (ipData.country_code) {
|
||||
this.userCountry = ipData.country_code.toLowerCase()
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Unable to fetch geo location:', error)
|
||||
}
|
||||
|
||||
this.emphasized = emphasized
|
||||
this.answers = answers
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue