Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

remove project #329

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/frontend/src/pages/subjectsPage/ProjectsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ export function ProjectsView({
}
deleteEvent={() =>
deleteAssignment(
project.index
project.assignment
.project_id
)
}
archiveEvent={() =>
Expand Down
13 changes: 7 additions & 6 deletions frontend/frontend/src/pages/subjectsPage/SubjectsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,20 @@ export function SubjectsPage() {
}

const [openDeletePopup, setOpenDeletePopup] = useState(false)
const [deleteIndex, setDeleteIndex] = useState(0)
const [deleteId, setDeleteId] = useState(0)
const [openArchivePopup, setOpenArchivePopup] = useState(false)
const [archiveIndex, setArchiveIndex] = useState(0)

const deleteAssignment = (index: number) => {
setDeleteIndex(index)
const deleteAssignment = (id: number) => {
setDeleteId(id)
setOpenDeletePopup(true)
}
const doDelete = async () => {
setAssignments(assignments.filter((_, i) => i !== deleteIndex))
setAssignments(
assignments.filter((project) => project.project_id !== deleteId)
)
try {
const deletedAssignment = assignments[deleteIndex]
await instance.delete(`/projecten/${deletedAssignment.project_id}/`)
await instance.delete(`/projecten/${deleteId}/`)
} catch (error) {
console.error('Error deleting data:', error)
}
Expand Down
Loading