feat: modules and module-editor pages

This commit is contained in:
2025-10-25 12:11:14 +04:00
parent 57a7ab0871
commit 2bdbebc453
40 changed files with 3485 additions and 38 deletions

View File

@ -0,0 +1,32 @@
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { AttributeSchema } from "@/lib/client";
import {
getAttributesOptions,
getProjectsQueryKey,
} from "@/lib/client/@tanstack/react-query.gen";
const useAttributesList = () => {
const queryClient = useQueryClient();
const { data, refetch } = useQuery(getAttributesOptions());
const queryKey = getProjectsQueryKey();
const setAttributes = (attributes: AttributeSchema[]) => {
queryClient.setQueryData(
queryKey,
(old: { items: AttributeSchema[] }) => ({
...old,
items: attributes,
})
);
};
return {
attributes: data?.items ?? [],
setAttributes,
refetch,
queryKey,
};
};
export default useAttributesList;