feat: move calculating api base url to store getter
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
97e761690d
commit
9a356b2564
|
@ -2,6 +2,7 @@ import {CONFIG} from '../mutation-types'
|
|||
import {HTTPFactory} from '@/http-common'
|
||||
import {objectToCamelCase} from '@/helpers/case'
|
||||
import {redirectToProvider} from '../../helpers/redirectToProvider'
|
||||
import {parseURL} from 'ufo'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
@ -37,6 +38,10 @@ export default {
|
|||
}),
|
||||
getters: {
|
||||
migratorsEnabled: state => state.availableMigrators?.length > 0,
|
||||
apiBase(state) {
|
||||
const {host, protocol} = parseURL(window.API_URL)
|
||||
return protocol + '//' + host
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
[CONFIG](state, config) {
|
||||
|
|
|
@ -41,15 +41,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
caldavUrl() {
|
||||
let apiBase = window.API_URL.replace('/api/v1', '')
|
||||
if (apiBase === '') { // Frontend and api on the same host which means we need to prefix the frontend url
|
||||
apiBase = this.$store.state.config.frontendUrl
|
||||
}
|
||||
if (apiBase.endsWith('/')) {
|
||||
apiBase = apiBase.substr(0, apiBase.length - 1)
|
||||
}
|
||||
|
||||
return `${apiBase}/dav/principals/${this.userInfo.username}/`
|
||||
return `${this.$store.getters['config/apiBase']}/dav/principals/${this.userInfo.username}/`
|
||||
},
|
||||
...mapState({
|
||||
caldavEnabled: state => state.config.caldavEnabled,
|
||||
|
|
Reference in New Issue