web-mikul-news/service/master-categories.tsx

30 lines
997 B
TypeScript
Raw Normal View History

2025-07-02 15:44:00 +00:00
import Cookies from "js-cookie";
2025-07-03 17:18:54 +00:00
import { httpDeleteInterceptor, httpGetInterceptor, httpPostInterceptor, httpPutInterceptor } from "./http-config/http-interceptor-services";
2025-07-02 15:44:00 +00:00
const token = Cookies.get("access_token");
export async function createCategory(data: any) {
const pathUrl = `/article-categories`;
2025-07-03 17:18:54 +00:00
return await httpPostInterceptor(pathUrl, data);
2025-07-02 15:44:00 +00:00
}
export async function updateCategory(id: string, data: any) {
const pathUrl = `/article-categories/${id}`;
2025-07-03 17:18:54 +00:00
return await httpPutInterceptor(pathUrl, data);
2025-07-02 15:44:00 +00:00
}
export async function getCategoryById(id: number) {
2025-07-03 17:18:54 +00:00
return await httpGetInterceptor(`/article-categories/${id}`);
2025-07-02 15:44:00 +00:00
}
export async function deleteCategory(id: number) {
2025-07-03 17:18:54 +00:00
return await httpDeleteInterceptor(`article-categories/${id}`);
2025-07-02 15:44:00 +00:00
}
export async function uploadCategoryThumbnail(id: string, data: any) {
const headers = {
"content-type": "multipart/form-data",
};
2025-07-03 17:18:54 +00:00
return await httpPostInterceptor(`/article-categories/thumbnail/${id}`, data, headers);
2025-07-02 15:44:00 +00:00
}