feat: move user settings to multiple components #889

Merged
konrad merged 27 commits from feature/user-settings into main 2021-10-26 20:58:03 +00:00
2 changed files with 6 additions and 9 deletions
Showing only changes of commit 9a356b2564 - Show all commits

View File

@ -2,6 +2,7 @@ import {CONFIG} from '../mutation-types'
import {HTTPFactory} from '@/http-common' import {HTTPFactory} from '@/http-common'
import {objectToCamelCase} from '@/helpers/case' import {objectToCamelCase} from '@/helpers/case'
import {redirectToProvider} from '../../helpers/redirectToProvider' import {redirectToProvider} from '../../helpers/redirectToProvider'
import {parseURL} from 'ufo'
export default { export default {
namespaced: true, namespaced: true,
@ -37,6 +38,10 @@ export default {
}), }),
getters: { getters: {
konrad marked this conversation as resolved Outdated

use state.availableMigrators?.length > 0

use `state.availableMigrators?.length > 0`
migratorsEnabled: state => state.availableMigrators?.length > 0, migratorsEnabled: state => state.availableMigrators?.length > 0,
apiBase(state) {
const {host, protocol} = parseURL(window.API_URL)
return protocol + '//' + host
},
}, },
mutations: { mutations: {
[CONFIG](state, config) { [CONFIG](state, config) {

View File

@ -41,15 +41,7 @@ export default {
}, },
computed: { computed: {
caldavUrl() { caldavUrl() {
let apiBase = window.API_URL.replace('/api/v1', '') return `${this.$store.getters['config/apiBase']}/dav/principals/${this.userInfo.username}/`
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}/`
}, },
...mapState({ ...mapState({
caldavEnabled: state => state.config.caldavEnabled, caldavEnabled: state => state.config.caldavEnabled,