feat: improve store and model typing
This commit is contained in:
@ -181,13 +181,13 @@ import {useStore} from 'vuex'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import {RIGHTS} from '@/models/constants/rights'
|
||||
import LinkShareModel from '@/models/linkShare'
|
||||
import type ListModel from '@/models/list'
|
||||
import LinkShareModel, { type ILinkShare } from '@/models/linkShare'
|
||||
|
||||
import LinkShareService from '@/services/linkShare'
|
||||
|
||||
import {useCopyToClipboard} from '@/composables/useCopyToClipboard'
|
||||
import {success} from '@/message'
|
||||
import type { IList } from '@/models/list'
|
||||
|
||||
const props = defineProps({
|
||||
listId: {
|
||||
@ -198,7 +198,7 @@ const props = defineProps({
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
const linkShares = ref<LinkShareModel[]>([])
|
||||
const linkShares = ref<ILinkShare[]>([])
|
||||
const linkShareService = shallowReactive(new LinkShareService())
|
||||
const selectedRight = ref(RIGHTS.READ)
|
||||
const name = ref('')
|
||||
@ -217,7 +217,7 @@ watch(
|
||||
const store = useStore()
|
||||
const frontendUrl = computed(() => store.state.config.frontendUrl)
|
||||
|
||||
async function load(listId: ListModel['id']) {
|
||||
async function load(listId: IList['id']) {
|
||||
// If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
|
||||
if (listId === 0) {
|
||||
return
|
||||
@ -226,7 +226,7 @@ async function load(listId: ListModel['id']) {
|
||||
linkShares.value = await linkShareService.getAll({listId})
|
||||
}
|
||||
|
||||
async function add(listId: ListModel['id']) {
|
||||
async function add(listId: IList['id']) {
|
||||
const newLinkShare = new LinkShareModel({
|
||||
right: selectedRight.value,
|
||||
listId,
|
||||
@ -242,7 +242,7 @@ async function add(listId: ListModel['id']) {
|
||||
await load(listId)
|
||||
}
|
||||
|
||||
async function remove(listId: ListModel['id']) {
|
||||
async function remove(listId: IList['id']) {
|
||||
try {
|
||||
await linkShareService.delete(new LinkShareModel({
|
||||
id: linkIdToDelete.value,
|
||||
|
Reference in New Issue
Block a user