import axiosInstance from "./axiosInstance"; export type CategoryType = { pk: number; name: string; }; export const getCategories = async () => { const res = await axiosInstance.get("/api/categories"); return res.data; }; export const getCategoryById = async (id: number) => { const res = await axiosInstance.get(`/api/categories/${id}`); return res.data; }; export const createCategory = async (name: string) => { const res = await axiosInstance.post(`/api/categories/`, { name }); return res.data; }; export const updateCategory = async (id: number, name: string) => { const res = await axiosInstance.put(`/api/categories/${id}`, { name }); return res.data; }; export const deleteCategory = async (id: number) => { const res = await axiosInstance.delete(`/api/categories/${id}`); return res.data; };