chore: extract getting all tokens into a composable
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2021-12-14 21:36:42 +01:00
parent e2fc5e940d
commit e4af8a950a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 10 additions and 7 deletions

View File

@ -78,6 +78,16 @@ import Message from '@/components/misc/message.vue'
import CaldavTokenService from '@/services/caldavToken'
import CaldavTokenModel from '@/models/caldavToken'
const service = new CaldavTokenService()
async function useToken() {
const tokens = ref<CaldavTokenModel[]>([])
tokens.value = await service.getAll()
return tokens
}
const tokens = useToken()
const store = useStore()
const {t} = useI18n()
@ -88,13 +98,6 @@ const caldavEnabled = computed(() => store.state.config.caldavEnabled)
const isLocalUser = computed(() => store.state.auth.info?.isLocalUser)
const username = computed(() => store.state.auth.info?.username)
const service = new CaldavTokenService()
const tokens = ref<CaldavTokenModel[]>([])
service.getAll()
.then((r: CaldavTokenModel[]) => {
tokens.value = r
})
const newToken = ref(null)
const createToken = async () => {
const r = await service.create({})