1
0

feat: improved types (#2547)

Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2547
Reviewed-by: konrad <k@knt.li>
This commit is contained in:
konrad
2022-11-02 16:06:55 +00:00
63 changed files with 444 additions and 340 deletions

View File

@ -86,7 +86,7 @@ export const useBaseStore = defineStore('base', () => {
}
async function handleSetCurrentList(
{list, forceUpdate = false}: {list: IList | null, forceUpdate: boolean},
{list, forceUpdate = false}: {list: IList | null, forceUpdate?: boolean},
) {
if (list === null) {
setCurrentList({})

View File

@ -1,12 +1,10 @@
import type { StoreDefinition } from 'pinia'
export interface LoadingState {
isLoading: boolean
}
const LOADING_TIMEOUT = 100
export const setModuleLoading = <LoadingStore extends StoreDefinition<string, LoadingState>>(store: LoadingStore, loadFunc : ((isLoading: boolean) => void) | null = null) => {
export const setModuleLoading = <Store extends LoadingState>(store: Store, loadFunc : ((isLoading: boolean) => void) | null = null) => {
const timeout = setTimeout(() => {
if (loadFunc === null) {
store.isLoading = true

View File

@ -364,7 +364,7 @@ export const useKanbanStore = defineStore('kanban', {
}
},
async updateBucket(updatedBucketData: IBucket) {
async updateBucket(updatedBucketData: Partial<IBucket>) {
const cancel = setModuleLoading(this)
const bucketIndex = findIndexById(this.buckets, updatedBucketData.id)

View File

@ -180,7 +180,7 @@ export const useListStore = defineStore('list', () => {
export function useList(listId: MaybeRef<IList['id']>) {
const listService = shallowReactive(new ListService())
const {loading: isLoading} = toRefs(listService)
const list: ListModel = reactive(new ListModel())
const list: IList = reactive(new ListModel())
const {t} = useI18n({useScope: 'global'})
watch(