feat(frontend): echte assignment titel, description en klas worden getoond

This commit is contained in:
Joyelle Ndagijimana 2025-04-08 21:08:07 +02:00
parent 5d69ea9aa4
commit 9aae5a3a46
7 changed files with 166 additions and 61 deletions

View file

@ -1,14 +1,15 @@
import {useMutation, useQueryClient, type UseMutationReturnType} from "@tanstack/vue-query";
import {AssignmentController, type AssignmentResponse} from "@/controllers/assignments.ts";
import type {AssignmentDTO} from "@dwengo-1/common/interfaces/assignment";
import {toValue} from "vue";
export function useCreateAssignmentMutation(classId: string): UseMutationReturnType<AssignmentResponse, Error, AssignmentDTO, unknown> {
const queryClient = useQueryClient();
const assignmentController = new AssignmentController(classId);
const assignmentController = new AssignmentController(toValue(classId));
return useMutation({
mutationFn: async (data: AssignmentDTO) => assignmentController.createAssignment(data),
mutationFn: async (data) => assignmentController.createAssignment(data),
onSuccess: async () => {
await queryClient.invalidateQueries({queryKey: ["assignments"]});
},