crud blog

This commit is contained in:
hamid zarghami
2025-04-15 14:06:49 +03:30
parent 9cbe0b23a3
commit 63aecce426
10 changed files with 708 additions and 90 deletions
+32
View File
@@ -0,0 +1,32 @@
import axios from "../../../config/axios";
import { CreateBlogType } from "../types/BlogTypes";
export const getBlogCategories = async () => {
const { data } = await axios.get("/blogs/categories/list");
return data;
};
export const getBlogs = async (search: string) => {
const { data } = await axios.get(`/blogs/list?q=${search}`);
return data;
};
export const getBlogDetail = async (id: string) => {
const { data } = await axios.get(`/blogs/${id}`);
return data;
};
export const createBlog = async (params: CreateBlogType) => {
const { data } = await axios.post("/blogs", params);
return data;
};
export const updateBlog = async (id: string, params: CreateBlogType) => {
const { data } = await axios.patch(`/blogs/${id}`, params);
return data;
};
export const deleteBlog = async (id: string) => {
const { data } = await axios.delete(`/blogs/${id}`);
return data;
};