chore: use ts for caldav component
This commit is contained in:
parent
6b899be202
commit
cb067461aa
1 changed files with 13 additions and 9 deletions
|
@ -9,10 +9,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<x-button
|
<x-button
|
||||||
@click="copy(caldavUrl)"
|
@click="copy(caldavUrl)"
|
||||||
:shadow="false"
|
:shadow="false"
|
||||||
v-tooltip="$t('misc.copy')"
|
v-tooltip="$t('misc.copy')"
|
||||||
icon="paste"
|
icon="paste"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,8 +74,9 @@ import {useStore} from 'vuex'
|
||||||
import {CALDAV_DOCS} from '@/urls'
|
import {CALDAV_DOCS} from '@/urls'
|
||||||
import {useTitle} from '@/composables/useTitle'
|
import {useTitle} from '@/composables/useTitle'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
import Message from '../../../components/misc/message'
|
import Message from '@/components/misc/message.vue'
|
||||||
import CaldavTokenService from '../../../services/caldavToken'
|
import CaldavTokenService from '@/services/caldavToken'
|
||||||
|
import CaldavTokenModel from '@/models/caldavToken'
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const {t} = useI18n()
|
const {t} = useI18n()
|
||||||
|
@ -88,9 +89,9 @@ const isLocalUser = computed(() => store.state.auth.info?.isLocalUser)
|
||||||
const username = computed(() => store.state.auth.info?.username)
|
const username = computed(() => store.state.auth.info?.username)
|
||||||
|
|
||||||
const service = new CaldavTokenService()
|
const service = new CaldavTokenService()
|
||||||
const tokens = ref([])
|
const tokens = ref<CaldavTokenModel[]>([])
|
||||||
service.getAll()
|
service.getAll()
|
||||||
.then(r => {
|
.then((r: CaldavTokenModel[]) => {
|
||||||
tokens.value = r
|
tokens.value = r
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -103,12 +104,15 @@ const createToken = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteToken = token => {
|
const deleteToken = (token: CaldavTokenModel) => {
|
||||||
service.delete(token)
|
service.delete(token)
|
||||||
|
// @ts-ignore
|
||||||
.then(r => {
|
.then(r => {
|
||||||
success(r)
|
success(r)
|
||||||
for (const i in tokens.value) {
|
for (const i in tokens.value) {
|
||||||
|
// @ts-ignore
|
||||||
if (tokens.value[i].id === token.id) {
|
if (tokens.value[i].id === token.id) {
|
||||||
|
// @ts-ignore
|
||||||
tokens.value.splice(i, 1)
|
tokens.value.splice(i, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue