This commit is contained in:
hamid zarghami
2025-02-13 10:58:22 +03:30
parent 9b45a9be65
commit 65faa4de5f
9 changed files with 365 additions and 117 deletions
+18 -1
View File
@@ -1,6 +1,9 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/LearningService";
import { CreateCategoryLearningType } from "../types/LearningTypes";
import {
CreateCategoryLearningType,
CreateLearningType,
} from "../types/LearningTypes";
export const useGetCategory = () => {
return useQuery({
@@ -15,3 +18,17 @@ export const useCreateCategory = () => {
api.createCategory(variables),
});
};
export const useCreateLearning = () => {
return useMutation({
mutationFn: (variables: CreateLearningType) =>
api.CreateLearning(variables),
});
};
export const useGetLearning = () => {
return useQuery({
queryKey: ["learnings"],
queryFn: api.getLearnings,
});
};