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