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

@ -74,8 +74,8 @@ const projectHistory = computed(() => {
}
return getHistory()
.map(l => projectStore.getProjectById(l.id))
.filter((l): l is IProject => l !== null)
.map(l => projectStore.projects[l.id])
.filter(l => Boolean(l))
})
const migratorsEnabled = computed(() => configStore.availableMigrators?.length > 0)

View File

@ -29,7 +29,7 @@ const props = defineProps({
})
const projectStore = useProjectStore()
const project = computed(() => projectStore.getProjectById(props.projectId))
const project = computed(() => projectStore.projects[props.projectId])
const htmlDescription = computed(() => {
const description = project.value?.description || ''
if (description === '') {

View File

@ -31,7 +31,7 @@ const projectStore = useProjectStore()
const router = useRouter()
const route = useRoute()
const project = computed(() => projectStore.getProjectById(route.params.projectId))
const project = computed(() => projectStore.projects[route.params.projectId])
useTitle(() => t('project.archive.title', {project: project.value.title}))
async function archiveProject() {

View File

@ -43,7 +43,7 @@ const router = useRouter()
const totalTasks = ref<number | null>(null)
const project = computed(() => projectStore.getProjectById(route.params.projectId))
const project = computed(() => projectStore.projects[route.params.projectId])
watchEffect(
() => {

View File

@ -39,9 +39,9 @@ const parentProject = ref<IProject | null>(null)
watch(
() => route.params.projectId,
projectId => {
const project = projectStore.getProjectById(route.params.projectId)
const project = projectStore.projects[route.params.projectId]
if (project.parentProjectId) {
parentProject.value = projectStore.getProjectById(project.parentProjectId)
parentProject.value = projectStore.projects[project.parentProjectId]
}
},
{immediate: true},

View File

@ -539,7 +539,7 @@ const visible = ref(false)
const taskId = toRef(props, 'taskId')
const project = computed(() => task.projectId ? projectStore.getProjectById(task.projectId) : null)
const project = computed(() => task.projectId ? projectStore.projects[task.projectId] : null)
watchEffect(() => {
baseStore.handleSetCurrentProject({
project: project.value,

View File

@ -245,7 +245,7 @@ watch(
const projectStore = useProjectStore()
const defaultProject = computed({
get: () => projectStore.getProjectById(settings.value.defaultProjectId) || undefined,
get: () => projectStore.projects[settings.value.defaultProjectId],
set(l) {
settings.value.defaultProjectId = l ? l.id : DEFAULT_PROJECT_ID
},