blog category crud

This commit is contained in:
hamid zarghami
2025-04-15 14:58:17 +03:30
parent 63aecce426
commit d3031e5557
11 changed files with 350 additions and 87 deletions
+24 -1
View File
@@ -1,11 +1,34 @@
import axios from "../../../config/axios";
import { CreateBlogType } from "../types/BlogTypes";
import { CreateBlogCategoryType, CreateBlogType } from "../types/BlogTypes";
export const getBlogCategories = async () => {
const { data } = await axios.get("/blogs/categories/list");
return data;
};
export const createBlogCategory = async (params: CreateBlogCategoryType) => {
const { data } = await axios.post("/blogs/categories", params);
return data;
};
export const updateBlogCategory = async (
id: string,
params: CreateBlogCategoryType
) => {
const { data } = await axios.patch(`/blogs/categories/${id}`, params);
return data;
};
export const deleteBlogCategory = async (id: string) => {
const { data } = await axios.delete(`/blogs/categories/${id}`);
return data;
};
export const getBlogCategoryDetail = async (id: string) => {
const { data } = await axios.get(`/blogs/categories/${id}`);
return data;
};
export const getBlogs = async (search: string) => {
const { data } = await axios.get(`/blogs/list?q=${search}`);
return data;