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 }); | ||||
| } | ||||
| 
 | ||||
| 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 classid = req.params.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'); | ||||
|     } | ||||
| 
 | ||||
|     await deleteAssignment(classid, id); | ||||
|     const assignment = await deleteAssignment(classid, id); | ||||
|     res.json({assignment}); | ||||
| } | ||||
| 
 | ||||
| export async function getAssignmentsSubmissionsHandler(req: Request, res: Response): Promise<void> { | ||||
|  |  | |||
|  | @ -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, | ||||
|         }); | ||||
|         mutate( | ||||
|             { cid: clsId, an: num }, | ||||
|             { | ||||
|                 onSuccess: () => { | ||||
|                     window.location.href = "/user/assignment"; | ||||
|                 }, | ||||
|             }, | ||||
|         ); | ||||
|     } | ||||
| </script> | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 () => { | ||||
|  |  | |||
		Reference in a new issue
	
	 Joyelle Ndagijimana
						Joyelle Ndagijimana