Raid Layout page working
This commit is contained in:
@@ -52,6 +52,25 @@ export function useGetClassGroupsCount(raidGroupId: string, searchTerm?: string)
|
||||
});
|
||||
}
|
||||
|
||||
export function useGetClassGroupsByRaidLayout(raidGroupId: string, raidLayoutId: string | undefined){
|
||||
return useQuery({
|
||||
queryKey: ["classGroups", "raidLayout", raidLayoutId],
|
||||
queryFn: async () => {
|
||||
const response = await api.get(`/raidGroup/${raidGroupId}/classGroup/raidLayout/${raidLayoutId}`);
|
||||
|
||||
if(response.status !== 200){
|
||||
throw new Error("Failed to get class groups");
|
||||
}
|
||||
else if(response.data.error){
|
||||
throw new Error(response.data.errors.join(", "));
|
||||
}
|
||||
|
||||
return response.data as (ClassGroup | null)[];
|
||||
},
|
||||
enabled: !!raidLayoutId
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function useCreateClassGroup(raidGroupId: string){
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
Reference in New Issue
Block a user