import { axiosInstance } from './axios'; import type { BlogPost } from '../types'; export const getBlogPosts = async (params?: { status?: string; tag?: string; search?: string; }): Promise => { const response = await axiosInstance.get('/blog', { params }); return response.data; }; export const getBlogPostById = async (id: string): Promise => { const response = await axiosInstance.get(`/blog/${id}`); return response.data; }; export const createBlogPost = async (payload: { title: string; content: string; tags?: string[]; thumbnailUrl?: string; status: 'draft' | 'published'; author?: string; }): Promise => { const response = await axiosInstance.post('/blog/new', payload); return response.data; }; export const updateBlogPost = async ( id: string, payload: Partial ): Promise => { const response = await axiosInstance.patch(`/blog/${id}`, payload); return response.data; }; export const deleteBlogPost = async (id: string): Promise => { await axiosInstance.delete(`/blog/${id}`); };