fix: assignment verwijderen volledig gefixd
This commit is contained in:
parent
d43db16989
commit
ec36e312fc
3 changed files with 13 additions and 10 deletions
|
@ -66,7 +66,7 @@ export async function putAssignmentHandler(req: Request, res: Response): Promise
|
||||||
res.json({ assignment });
|
res.json({ assignment });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteAssignmentHandler(req: Request, _res: Response): Promise<void> {
|
export async function deleteAssignmentHandler(req: Request, res: Response): Promise<void> {
|
||||||
const id = Number(req.params.id);
|
const id = Number(req.params.id);
|
||||||
const classid = req.params.classid;
|
const classid = req.params.classid;
|
||||||
requireFields({ id, classid });
|
requireFields({ id, classid });
|
||||||
|
@ -75,7 +75,8 @@ export async function deleteAssignmentHandler(req: Request, _res: Response): Pro
|
||||||
throw new BadRequestException('Assignment id should be a number');
|
throw new BadRequestException('Assignment id should be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
await deleteAssignment(classid, id);
|
const assignment = await deleteAssignment(classid, id);
|
||||||
|
res.json({assignment});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAssignmentsSubmissionsHandler(req: Request, res: Response): Promise<void> {
|
export async function getAssignmentsSubmissionsHandler(req: Request, res: Response): Promise<void> {
|
||||||
|
|
|
@ -73,11 +73,14 @@ Const {groupProgressMap} = props.useGroupsWithProgress(
|
||||||
const { mutate } = useDeleteAssignmentMutation();
|
const { mutate } = useDeleteAssignmentMutation();
|
||||||
|
|
||||||
async function deleteAssignment(num: number, clsId: string): Promise<void> {
|
async function deleteAssignment(num: number, clsId: string): Promise<void> {
|
||||||
mutate({
|
mutate(
|
||||||
cid: clsId,
|
{ cid: clsId, an: num },
|
||||||
an: num,
|
{
|
||||||
});
|
onSuccess: () => {
|
||||||
window.location.href = "/user/assignment";
|
window.location.href = "/user/assignment";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, onMounted, watch} from "vue";
|
import { ref, computed, onMounted, watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import auth from "@/services/auth/auth-service.ts";
|
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 { ClassController } from "@/controllers/classes.ts";
|
||||||
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
||||||
import { asyncComputed } from "@vueuse/core";
|
import { asyncComputed } from "@vueuse/core";
|
||||||
import {useCreateAssignmentMutation, useDeleteAssignmentMutation} from "@/queries/assignments.ts";
|
import { useDeleteAssignmentMutation } from "@/queries/assignments.ts";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -70,7 +70,6 @@ import {ref, computed, onMounted, watch} from "vue";
|
||||||
|
|
||||||
async function goToDeleteAssignment(num: number, clsId: string): Promise<void> {
|
async function goToDeleteAssignment(num: number, clsId: string): Promise<void> {
|
||||||
mutate({ cid: clsId, an: num });
|
mutate({ cid: clsId, an: num });
|
||||||
window.location.reload(); // Remove later when isSuccess works
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue