mediahub-fe/service/blog/blog.ts

51 lines
1.3 KiB
TypeScript

import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
export async function paginationBlog(
size: any,
page: number,
title: string = "",
categoryFilter: any,
statusFilter: any
) {
return await httpGetInterceptor(
`blog/pagination?enablePage=1&page=${page}&size=${size}&title=${title}&categoryId=${categoryFilter}&statusId=${statusFilter}`
);
}
export async function postBlog(data: any) {
const url = "blog";
return httpPostInterceptor(url, data);
}
export async function getBlog(id: any) {
const url = `blog/${id}`;
return httpGetInterceptor(url);
}
export async function uploadThumbnailBlog(id: any, data: any) {
const url = `blog/${id}/thumbnail`;
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, headers);
}
export async function deleteBlog(id: any) {
const url = `blog?id=${id}`;
return httpDeleteInterceptor(url);
}
export async function getBlogCategory() {
const url = "blog/categories/enable";
return httpGetInterceptor(url);
}
export async function publicListBlog(page: any, limit: any) {
const url = `blog/public/pagination?enablePage=1&page=${page}&size=${limit}`;
return httpGetInterceptor(url);
}