Skip to content

Commit

Permalink
je hoeft niet meer handmatig te refreshen na archiveren van een vak
Browse files Browse the repository at this point in the history
  • Loading branch information
gusvanpoucke committed May 21, 2024
1 parent e85ba8e commit 7909976
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/frontend/src/pages/mainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export default function MainPage() {
}
const doArchive = async () => {
console.log('Archive clicked')
const newCourses = courses.map((course) =>
course.vak_id == archiveCourseId ? archiveSingleCourse(course) : course
)
setCourses(newCourses)
try {
await instance.patch(`/vakken/${archiveCourseId}/`, {
gearchiveerd: true,
Expand Down Expand Up @@ -370,3 +374,10 @@ export default function MainPage() {
</>
)
}

function archiveSingleCourse(course: Course): Course {
return {
...course,
gearchiveerd: true,
}
}

0 comments on commit 7909976

Please sign in to comment.