feat(navigation): allow dragging a project out from its parent project

This commit is contained in:
kolaente 2023-03-27 13:22:03 +02:00
parent c6f3829387
commit fa71cec5c8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 7 deletions

View File

@ -151,13 +151,11 @@ async function saveProjectPosition(e: SortableEvent) {
projectAfter !== null ? projectAfter.position : null,
)
console.log({
position,
newIndex,
project: project.id,
projectBefore: projectBefore?.id,
projectAfter: projectAfter?.id,
})
if (project.parentProjectId !== parentProjectId) {
const parentProject = projectStore.getProjectById(project.parentProjectId)
const childProjectIndex = parentProject.childProjects.findIndex(p => p.id === project.id)
parentProject.childProjects.splice(childProjectIndex, 1)
}
try {
// create a copy of the project in order to not violate pinia manipulation