You've already forked AstralRinth
forked from didirus/AstralRinth
Use base URL for axios (#241)
* Switch site to use axios base url * Fix team invites * Fix find/replace setting the wrong thing * Fix analytics being blocking, small issues
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import axios from 'axios'
|
||||
export default async function (context) {
|
||||
export default function (context) {
|
||||
if (context.$config.analytics.base_url == null) {
|
||||
return
|
||||
}
|
||||
let domain = ''
|
||||
if (process.server) {
|
||||
domain = context.req.headers.host
|
||||
@@ -8,13 +11,16 @@ export default async function (context) {
|
||||
}
|
||||
const url = context.$config.analytics.base_url + '/register/visit'
|
||||
const path = context.route.path.split('?')[0]
|
||||
try {
|
||||
return await axios.post(url, {
|
||||
path,
|
||||
domain,
|
||||
consent: false,
|
||||
})
|
||||
} catch (e) {
|
||||
// Simply silence the issue.
|
||||
}
|
||||
setTimeout(() => {
|
||||
axios
|
||||
.post(url, {
|
||||
path,
|
||||
domain,
|
||||
consent: false,
|
||||
})
|
||||
.then(() => {})
|
||||
.catch((e) => {
|
||||
console.error('An error occurred while registering the visit: ', e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user