42 lines
901 B
TypeScript
42 lines
901 B
TypeScript
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
import * as api from "../service/IconService";
|
|
import { GroupIconsResponse } from "../types/Types";
|
|
|
|
export const useGetIcons = () => {
|
|
return useQuery({
|
|
queryKey: ["icons"],
|
|
queryFn: api.getIcons,
|
|
});
|
|
};
|
|
|
|
export const useCreateGroupIcon = () => {
|
|
return useMutation({
|
|
mutationFn: api.createGroupIcon,
|
|
});
|
|
};
|
|
|
|
export const useGetGroupIcons = () => {
|
|
return useQuery<GroupIconsResponse>({
|
|
queryKey: ["group-icons"],
|
|
queryFn: api.getGroupIcons,
|
|
});
|
|
};
|
|
|
|
export const useDeleteGroupIcon = () => {
|
|
return useMutation({
|
|
mutationFn: (id: string) => api.deleteGroupIcon(id),
|
|
});
|
|
};
|
|
|
|
export const useCreateIcon = () => {
|
|
return useMutation({
|
|
mutationFn: api.createIcon,
|
|
});
|
|
};
|
|
|
|
export const useDeleteIcon = () => {
|
|
return useMutation({
|
|
mutationFn: (id: string) => api.deleteIcon(id),
|
|
});
|
|
};
|