Raid Instances showing up on calendar

This commit is contained in:
2025-03-15 18:37:57 -04:00
parent ea0018bae2
commit 0eeedf1e3b
3 changed files with 31 additions and 3 deletions

View File

@@ -165,3 +165,22 @@ export function useDeleteRaidGroupCalendarEvent(raidGroupId: string){
}
});
}
export function useGetRaidInstanceCalendarEvents(raidGroupId?: string){
return useQuery({
queryKey: ["raidInstanceCalendarEvents", raidGroupId],
queryFn: async () => {
const response = await api.get(`/calendar/raidGroup/${raidGroupId}/raidInstance`);
if(response.status !== 200){
throw new Error("Failed to get raid instance calendar events");
}
else if(response.data.errors){
throw new Error(response.data.errors.join(", "));
}
return response.data as CalendarEvent[];
},
enabled: !!raidGroupId && raidGroupId !== ""
});
}