diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index fef559f3f..99dbd0159 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -156,8 +156,8 @@ import {calculateItemPosition} from '@/helpers/calculateItemPosition' import {getNamespaceTitle} from '@/helpers/getNamespaceTitle' import {getListTitle} from '@/helpers/getListTitle' import {useEventListener} from '@vueuse/core' -import type NamespaceModel from '@/models/namespace' -import type ListModel from '@/models/list' +import type { IList } from '@/models/list' +import type { INamespace } from '@/models/namespace' const drag = ref(false) const dragOptions = { @@ -172,7 +172,7 @@ const loading = computed(() => store.state.loading && store.state.loadingModule const namespaces = computed(() => { - return (store.state.namespaces.namespaces as NamespaceModel[]).filter(n => !n.isArchived) + return (store.state.namespaces.namespaces as INamespace[]).filter(n => !n.isArchived) }) const activeLists = computed(() => { return namespaces.value.map(({lists}) => { @@ -195,7 +195,7 @@ useEventListener('resize', resize) onMounted(() => resize()) -function toggleFavoriteList(list: ListModel) { +function toggleFavoriteList(list: IList) { // The favorites pseudo list is always favorite // Archived lists cannot be marked favorite if (list.id === -1 || list.isArchived) { @@ -209,14 +209,14 @@ function resize() { store.commit(MENU_ACTIVE, window.innerWidth >= 770) } -function toggleLists(namespaceId: NamespaceModel['id']) { +function toggleLists(namespaceId: INamespace['id']) { listsVisible.value[namespaceId] = !listsVisible.value[namespaceId] } -const listsVisible = ref<{ [id: NamespaceModel['id']]: boolean }>({}) +const listsVisible = ref<{ [id: INamespace['id']]: boolean }>({}) // FIXME: async action will be unfinished when component mounts onBeforeMount(async () => { - const namespaces = await store.dispatch('namespaces/loadNamespaces') as NamespaceModel[] + const namespaces = await store.dispatch('namespaces/loadNamespaces') as INamespace[] namespaces.forEach(n => { if (typeof listsVisible.value[n.id] === 'undefined') { listsVisible.value[n.id] = true @@ -224,7 +224,7 @@ onBeforeMount(async () => { }) }) -function updateActiveLists(namespace: NamespaceModel, activeLists: ListModel[]) { +function updateActiveLists(namespace: INamespace, activeLists: IList[]) { // This is a bit hacky: since we do have to filter out the archived items from the list // for vue draggable updating it is not as simple as replacing it. // To work around this, we merge the active lists with the archived ones. Doing so breaks the order @@ -241,7 +241,7 @@ function updateActiveLists(namespace: NamespaceModel, activeLists: ListModel[]) }) } -const listUpdating = ref<{ [id: NamespaceModel['id']]: boolean }>({}) +const listUpdating = ref<{ [id: INamespace['id']]: boolean }>({}) async function saveListPosition(e: SortableEvent) { if (!e.newIndex) return diff --git a/src/components/list/list-settings-dropdown.vue b/src/components/list/list-settings-dropdown.vue index 74cafb884..180596b2c 100644 --- a/src/components/list/list-settings-dropdown.vue +++ b/src/components/list/list-settings-dropdown.vue @@ -76,24 +76,24 @@ diff --git a/src/views/user/settings/Caldav.vue b/src/views/user/settings/Caldav.vue index ad63f8d33..5d8cec387 100644 --- a/src/views/user/settings/Caldav.vue +++ b/src/views/user/settings/Caldav.vue @@ -77,8 +77,8 @@ import {success} from '@/message' import BaseButton from '@/components/base/BaseButton.vue' import Message from '@/components/misc/message.vue' import CaldavTokenService from '@/services/caldavToken' -import type CaldavTokenModel from '@/models/caldavToken' import { formatDateShort } from '@/helpers/time/formatDate' +import type { ICaldavToken } from '@/models/caldavToken' const copy = useCopyToClipboard() @@ -86,19 +86,19 @@ const {t} = useI18n({useScope: 'global'}) useTitle(() => `${t('user.settings.caldav.title')} - ${t('user.settings.title')}`) const service = shallowReactive(new CaldavTokenService()) -const tokens = ref([]) +const tokens = ref([]) -service.getAll().then((result: CaldavTokenModel[]) => { +service.getAll().then((result: ICaldavToken[]) => { tokens.value = result }) -const newToken = ref() +const newToken = ref() async function createToken() { - newToken.value = await service.create({}) as CaldavTokenModel + newToken.value = await service.create({}) as ICaldavToken tokens.value.push(newToken.value) } -async function deleteToken(token: CaldavTokenModel) { +async function deleteToken(token: ICaldavToken) { const r = await service.delete(token) tokens.value = tokens.value.filter(({id}) => id !== token.id) success(r)