fix: assignment verwijderen volledig gefixd

This commit is contained in:
Joyelle Ndagijimana 2025-04-22 13:09:24 +02:00
parent d43db16989
commit ec36e312fc
3 changed files with 13 additions and 10 deletions

View file

@ -73,11 +73,14 @@ Const {groupProgressMap} = props.useGroupsWithProgress(
const { mutate } = useDeleteAssignmentMutation();
async function deleteAssignment(num: number, clsId: string): Promise<void> {
mutate({
cid: clsId,
an: num,
});
window.location.href = "/user/assignment";
mutate(
{ cid: clsId, an: num },
{
onSuccess: () => {
window.location.href = "/user/assignment";
},
},
);
}
</script>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import {ref, computed, onMounted, watch} from "vue";
import { ref, computed, onMounted, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import auth from "@/services/auth/auth-service.ts";
@ -8,7 +8,7 @@ import {ref, computed, onMounted, watch} from "vue";
import { ClassController } from "@/controllers/classes.ts";
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
import { asyncComputed } from "@vueuse/core";
import {useCreateAssignmentMutation, useDeleteAssignmentMutation} from "@/queries/assignments.ts";
import { useDeleteAssignmentMutation } from "@/queries/assignments.ts";
const { t } = useI18n();
const router = useRouter();
@ -70,7 +70,6 @@ import {ref, computed, onMounted, watch} from "vue";
async function goToDeleteAssignment(num: number, clsId: string): Promise<void> {
mutate({ cid: clsId, an: num });
window.location.reload(); // Remove later when isSuccess works
}
onMounted(async () => {