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,
|
||||
|
@ -143,18 +143,22 @@ import {useStore} from 'vuex'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import UserNamespaceService from '@/services/userNamespace'
|
||||
import UserNamespaceModel from '@/models/userNamespace'
|
||||
import UserListModel from '@/models/userList'
|
||||
import UserNamespaceModel, { type IUserNamespace } from '@/models/userNamespace'
|
||||
|
||||
import UserListService from '@/services/userList'
|
||||
import UserListModel, { type IUserList } from '@/models/userList'
|
||||
|
||||
import UserService from '@/services/user'
|
||||
import UserModel from '@/models/user'
|
||||
import UserModel, { type IUser } from '@/models/user'
|
||||
|
||||
import TeamNamespaceService from '@/services/teamNamespace'
|
||||
import TeamNamespaceModel from '@/models/teamNamespace'
|
||||
import TeamListModel from '@/models/teamList'
|
||||
import TeamNamespaceModel, { type ITeamNamespace } from '@/models/teamNamespace'
|
||||
|
||||
import TeamListService from '@/services/teamList'
|
||||
import TeamListModel, { type ITeamList } from '@/models/teamList'
|
||||
|
||||
import TeamService from '@/services/team'
|
||||
import TeamModel from '@/models/team'
|
||||
import TeamModel, { type ITeam } from '@/models/team'
|
||||
|
||||
import {RIGHTS} from '@/models/constants/rights'
|
||||
import Multiselect from '@/components/input/multiselect.vue'
|
||||
@ -183,10 +187,10 @@ const props = defineProps({
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
// This user service is either a userNamespaceService or a userListService, depending on the type we are using
|
||||
let stuffService: ShallowReactive<UserNamespaceService | UserListService | TeamListService | TeamNamespaceService>
|
||||
let stuffModel: UserNamespaceModel | UserListModel | TeamListModel | TeamNamespaceModel
|
||||
let searchService: ShallowReactive<UserService | TeamService>
|
||||
let sharable: Ref<UserModel | TeamModel>
|
||||
let stuffService: UserNamespaceService | UserListService | TeamListService | TeamNamespaceService
|
||||
let stuffModel: IUserNamespace | IUserList | ITeamList | ITeamNamespace
|
||||
let searchService: UserService | TeamService
|
||||
let sharable: Ref<IUser | ITeam>
|
||||
|
||||
const searchLabel = ref('')
|
||||
const selectedRight = ref({})
|
||||
|
Reference in New Issue
Block a user