1
0

fix: remove getProjectById and replace all usages of it

This commit is contained in:
kolaente
2023-04-12 11:13:55 +02:00
parent 9402344b7e
commit 78158bcba5
14 changed files with 24 additions and 28 deletions

View File

@ -36,9 +36,6 @@ export const useProjectStore = defineStore('project', () => {
.filter(p => !p.isArchived && p.isFavorite))
const hasProjects = computed(() => projects.value ? true : false)
const getProjectById = computed(() => {
return (id: IProject['id']) => typeof projects.value[id] !== 'undefined' ? projects.value[id] : null
})
const getChildProjects = computed(() => {
return (id: IProject['id']) => projectsArray.value.filter(p => p.parentProjectId === id) || []
})
@ -190,7 +187,6 @@ export const useProjectStore = defineStore('project', () => {
favoriteProjects: readonly(favoriteProjects),
hasProjects: readonly(hasProjects),
getProjectById,
getChildProjects,
findProjectByExactname,
searchProject,
@ -229,7 +225,7 @@ export function useProject(projectId: MaybeRef<IProject['id']>) {
() => project.parentProjectId,
projectId => {
if (project.parentProjectId) {
parentProject.value = projectStore.getProjectById(project.parentProjectId)
parentProject.value = projectStore.projects[project.parentProjectId]
}
},
{immediate: true},