Fix caldav url not containing the api url if the frontend and api are on the same domain
This commit is contained in:
parent
a2ad84fefd
commit
db90a8cde4
1 changed files with 19 additions and 13 deletions
|
@ -299,8 +299,6 @@ export default {
|
||||||
totpDisableForm: false,
|
totpDisableForm: false,
|
||||||
totpDisablePassword: '',
|
totpDisablePassword: '',
|
||||||
|
|
||||||
caldavUrl: '',
|
|
||||||
|
|
||||||
settings: UserSettingsModel,
|
settings: UserSettingsModel,
|
||||||
userSettingsService: UserSettingsService,
|
userSettingsService: UserSettingsService,
|
||||||
}
|
}
|
||||||
|
@ -325,17 +323,29 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.totpStatus()
|
this.totpStatus()
|
||||||
this.buildCaldavUrl()
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setTitle('Settings')
|
this.setTitle('Settings')
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: {
|
||||||
totpEnabled: state => state.config.totpEnabled,
|
caldavUrl() {
|
||||||
migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0,
|
let apiBase = window.API_URL.replace('/api/v1', '')
|
||||||
caldavEnabled: state => state.config.caldavEnabled,
|
if (apiBase === '') { // Frontend and api on the same host which means we need to prefix the frontend url
|
||||||
userInfo: state => state.auth.info,
|
apiBase = this.$store.state.config.frontendUrl
|
||||||
}),
|
}
|
||||||
|
if (apiBase.endsWith('/')) {
|
||||||
|
apiBase = apiBase.substr(0, apiBase.length - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${apiBase}/dav/principals/${this.userInfo.username}/`
|
||||||
|
},
|
||||||
|
...mapState({
|
||||||
|
totpEnabled: state => state.config.totpEnabled,
|
||||||
|
migratorsEnabled: state => state.config.availableMigrators !== null && state.config.availableMigrators.length > 0,
|
||||||
|
caldavEnabled: state => state.config.caldavEnabled,
|
||||||
|
userInfo: state => state.auth.info,
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updatePassword() {
|
updatePassword() {
|
||||||
if (this.passwordConfirm !== this.passwordUpdate.newPassword) {
|
if (this.passwordConfirm !== this.passwordUpdate.newPassword) {
|
||||||
|
@ -416,10 +426,6 @@ export default {
|
||||||
})
|
})
|
||||||
.catch(e => this.error(e, this))
|
.catch(e => this.error(e, this))
|
||||||
},
|
},
|
||||||
buildCaldavUrl() {
|
|
||||||
const apiBase = window.API_URL.replace('/api/v1', '')
|
|
||||||
this.caldavUrl = `${apiBase}/dav/principals/${this.userInfo.username}/`
|
|
||||||
},
|
|
||||||
copy(text) {
|
copy(text) {
|
||||||
copy(text)
|
copy(text)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue