1
0

feat: port config store to pinia

This commit is contained in:
Dominik Pschenitschni
2022-09-21 02:21:22 +02:00
parent 9e8c429864
commit a737fc5bc2
21 changed files with 93 additions and 68 deletions

View File

@ -79,6 +79,7 @@ import Message from '@/components/misc/message.vue'
import CaldavTokenService from '@/services/caldavToken'
import { formatDateShort } from '@/helpers/time/formatDate'
import type {ICaldavToken} from '@/modelTypes/ICaldavToken'
import {useConfigStore} from '@/stores/config'
const copy = useCopyToClipboard()
@ -105,8 +106,9 @@ async function deleteToken(token: ICaldavToken) {
}
const store = useStore()
const configStore = useConfigStore()
const username = computed(() => store.state.auth.info?.username)
const caldavUrl = computed(() => `${store.getters['config/apiBase']}/dav/principals/${username.value}/`)
const caldavEnabled = computed(() => store.state.config.caldavEnabled)
const caldavUrl = computed(() => `${configStore.apiBase}/dav/principals/${username.value}/`)
const caldavEnabled = computed(() => configStore.caldavEnabled)
const isLocalUser = computed(() => store.state.auth.info?.isLocalUser)
</script>

View File

@ -96,6 +96,7 @@ import {parseDateOrNull} from '@/helpers/parseDateOrNull'
import {formatDateShort, formatDateSince} from '@/helpers/time/formatDate'
import {useTitle} from '@/composables/useTitle'
import {success} from '@/message'
import {useConfigStore} from '@/stores/config'
const {t} = useI18n({useScope: 'global'})
useTitle(() => `${t('user.deletion.title')} - ${t('user.settings.title')}`)
@ -105,7 +106,9 @@ const password = ref('')
const errPasswordRequired = ref(false)
const store = useStore()
const userDeletionEnabled = computed(() => store.state.config.userDeletionEnabled)
const configStore = useConfigStore()
const userDeletionEnabled = computed(() => configStore.userDeletionEnabled)
const deletionScheduledAt = computed(() => parseDateOrNull(store.state.auth.info?.deletionScheduledAt))
const passwordInput = ref()

View File

@ -70,7 +70,6 @@ export default { name: 'user-settings-totp' }
<script lang="ts" setup>
import {computed, ref, shallowReactive} from 'vue'
import {useStore} from '@/store'
import {useI18n} from 'vue-i18n'
import TotpService from '@/services/totp'
@ -78,7 +77,8 @@ import TotpModel from '@/models/totp'
import {success} from '@/message'
import { useTitle } from '@/composables/useTitle'
import {useTitle} from '@/composables/useTitle'
import {useConfigStore} from '@/stores/config'
const {t} = useI18n({useScope: 'global'})
useTitle(() => `${t('user.settings.totp.title')} - ${t('user.settings.title')}`)
@ -92,8 +92,8 @@ const totpConfirmPasscode = ref('')
const totpDisableForm = ref(false)
const totpDisablePassword = ref('')
const store = useStore()
const totpEnabled = computed(() => store.state.config.totpEnabled)
const configStore = useConfigStore()
const totpEnabled = computed(() => configStore.totpEnabled)
totpStatus()