Use the current domain if the api path is relative to the frontend host
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-10-10 19:12:22 +02:00
parent 08e44a4509
commit 50fe5d5ef2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,9 @@ export default {
},
methods: {
apiDomain() {
if (window.API_URL.startsWith('/api/v1')) {
return window.location.host
}
const urlParts = window.API_URL.replace('http://', '').replace('https://', '').split(/[/?#]/)
return urlParts[0]
},
@ -158,6 +161,7 @@ export default {
this.successMsg = `Using Vikunja installation at "${this.apiDomain()}".`
localStorage.setItem('API_URL', window.API_URL)
this.configureApi = false
this.apiUrl = window.API_URL
}
})
},