blog category crud
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user