feat: move user settings to multiple components #889
|
@ -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
|
|||||||
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) {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Reference in New Issue
Block a user
use
state.availableMigrators?.length > 0