fix: assignment verwijderen
This commit is contained in:
		
							parent
							
								
									dbd9e2cd53
								
							
						
					
					
						commit
						f44b8fd554
					
				
					 2 changed files with 12 additions and 9 deletions
				
			
		|  | @ -146,7 +146,7 @@ export function useDeleteAssignmentMutation(): UseMutationReturnType< | ||||||
| 
 | 
 | ||||||
|             await invalidateAllAssignmentKeys(queryClient, cid, an); |             await invalidateAllAssignmentKeys(queryClient, cid, an); | ||||||
|             await invalidateAllGroupKeys(queryClient, cid, an); |             await invalidateAllGroupKeys(queryClient, cid, an); | ||||||
|             await invalidateAllSubmissionKeys(queryClient, cid, an); |             await invalidateAllSubmissionKeys(queryClient, undefined, undefined, undefined, cid, an); | ||||||
|         }, |         }, | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
|     import { ref, computed, onMounted } 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 { 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 { useDeleteAssignmentMutation } from "@/queries/assignments.ts"; |     import {useCreateAssignmentMutation, useDeleteAssignmentMutation} from "@/queries/assignments.ts"; | ||||||
| 
 | 
 | ||||||
|     const { t } = useI18n(); |     const { t } = useI18n(); | ||||||
|     const router = useRouter(); |     const router = useRouter(); | ||||||
|  | @ -60,14 +60,17 @@ | ||||||
|         await router.push(`/assignment/${clsId}/${id}`); |         await router.push(`/assignment/${clsId}/${id}`); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const { mutate } = useDeleteAssignmentMutation(); |     const { mutate, data, isSuccess } = useDeleteAssignmentMutation(); | ||||||
|  | 
 | ||||||
|  |     watch([isSuccess, data], async ([success, oldData]) => { | ||||||
|  |         if (success && oldData?.assignment) { | ||||||
|  |             window.location.reload(); | ||||||
|  |         } | ||||||
|  |     }); | ||||||
| 
 | 
 | ||||||
|     async function goToDeleteAssignment(num: number, clsId: string): Promise<void> { |     async function goToDeleteAssignment(num: number, clsId: string): Promise<void> { | ||||||
|         mutate({ |         mutate({ cid: clsId, an: num }); | ||||||
|             cid: clsId, |         window.location.reload(); // Remove later when isSuccess works | ||||||
|             an: num, |  | ||||||
|         }); |  | ||||||
|         window.location.reload(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     onMounted(async () => { |     onMounted(async () => { | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Joyelle Ndagijimana
						Joyelle Ndagijimana